RESOLVED DUPLICATE of bug 23933 19901
XMLHttpRequest Async Request onreadystate does not go past 1 when uploading a file
https://bugs.webkit.org/show_bug.cgi?id=19901
Summary XMLHttpRequest Async Request onreadystate does not go past 1 when uploading a...
Shiv Kumar
Reported 2008-07-05 01:24:38 PDT
When uploading a file using multipart/form-data enc type, firing an async xmlhttp request the onreadystate does not go beyond 1 (in a rage of 1-4). As a result no asyc xmlhttp requests can be made while a file upload is taking place (thus no progress information can be got from the server asynchronously. Making an xmlhttp synchronous request works as excepted. This works in all IE and Firefox versions that support AJAX.
Attachments
Alexey Proskuryakov
Comment 1 2009-04-02 01:08:30 PDT
Do you have an example of this problem? It's not clear what you mean by file upload - is it form submission?
Shiv Kumar
Comment 2 2009-04-02 01:18:55 PDT
(In reply to comment #1) > Do you have an example of this problem? It's not clear what you mean by file > upload - is it form submission? Uploading a file using a form with enc-type set to multipart/form-data. Don't know how else to explain this. I'm uploading a file. So essentially, while I'm uploading a file (that is the file upload is in progress, I'm trying to make an asyc xmlHttp request. This does not work as expected (as explained previously). All this does work in other browsers. The synchronous version does work here as well but the async version does not work.
Alexey Proskuryakov
Comment 3 2009-04-02 01:47:53 PDT
Thanks! This is the same as bug 23933, which was filed later, but has somewhat more detail and a test case, so I'll mark this as a duplicate. A workaround in your case is to use XMLHttpRequest file upload instead of form submission. This is not supported in any Safari release yet, but is supported in Safari 4 beta. Untested pseudo-code: var fileInputElement = ... var file = fileInputElement.files[0]; // multiple files in one input element are supported var req = new XMLHttpRequest; req.open(...); req.send(file); *** This bug has been marked as a duplicate of 23933 ***
Note You need to log in before you can comment on or make changes to this bug.