javascript - Fine Uploader error with internet explorer 10 -
i using fine uploader 3.7.0 in project chrome , firefox , works fine, internet explorer 10 files uploaded correctly user "upload failed" error message, demo tests:
<script> $(document).ready(function() { var errorhandler = function(event, id, filename, reason) { qq.log("id: " + id + ", filename: " + filename + ", reason: " + reason); }; var myuploader = new qq.fineuploader({ element: $('#basicuploadbutton')[0], multiple: false, callbacks: { onerror: errorhandler }, request: { endpoint: '/fineupload/receiver' } }); }); </script> <div class="fineuploader"> <span>please upload files automated process.</span> <div id="basicuploadbutton" class="upload-btn"></div> </div> <br /> <div><a href="#" onclick="window.close()">close window</a></div>
i debugged servlet , see sending this:
writer.print("{\"success\": true, \"uuid\": \"" + requestparser.getuuid() + "\", \"originalfilename\": \"" + requestparser.getfilename() + "\"}");
so think json supposed correct.
any ideas why can failing ie10? tried compatibility modes , didn't work.
updated: console log:
[fineuploader 3.7.0] error when attempting parse xhr response text (syntaxerror: invalid character) id: blog.jpg, filename: upload failure reason unknown, reason: [object xmlhttprequest]
thanks!
the problem due json response creating in java.
looking @ network tab in ie10 developer tools (thanks ray advice) get:
{"error": "java.io.filenotfoundexception: c:\data\uploads\fd9b5240-5661-4f07-a216-7a76b2250b00_c:\folder\blog.jpg (the filename, directory name, or volume label syntax incorrect)"}
i using
writer.print("{\"success\": true, \"uuid\": \"" + requestparser.getuuid() + "\", \"originalfilename\": \"" + requestparser.getfilename() + "\"}");
instead of
jsonobject json = new org.json.jsonobject(); json.put("success", true); json.put("uuid", requestparser.getuuid()); json.put("originalfilename", requestparser.getfilename()); writer.print(json.tostring());
works fine every browser.
anyway, needed avoid file name ie10 manages (c:\folder\blog.jpg) had use
json.put("originalfilename", getcorrectfilename(requestparser.getfilename()));
with getcorrectfilename(string s) removing "c:\folder\" part.
Comments
Post a Comment