5

I have a problem with xmlhttprequest file uploading progress event on Google Chrome for ios6. code already work on all desktop browsers and Safari(ios 6). also there is a problem wiht uploading mov files in google chrome (ios 6), when trying to upload I get file size = 0. Is there any solution for it ?

this is part of my code

var xhr = new XMLHttpRequest();
var eventSource = xhr.upload;

xhr.addEventListener("load", this.onUploadComplete(uploadInfo));
xhr.addEventListener("error", this.onUploadError(uploadInfo));
xhr.addEventListener("abort", this.onUploadAbort(uploadInfo));

// changing Url  for preventing ajax call caching( Android , IOS 6)
var ts = Date.now(), rquery = /\?/, rts = /([?&])_=[^&]*/,
ret = uploadUrl.replace( rts, "$1_=" + ts );
uploadUrl = ret + ( ( ret === uploadUrl ) ? ( rquery.test( uploadUrl ) ? "&" : "?" ) + "_=" + ts : "" );

xhr.open('POST', uploadUrl, true);  
eventSource.onprogress = this.onUploadProgress(uploadInfo);
xhr.setRequestHeader("Content-Type", "multipart/form-data");

xhr.setRequestHeader('X-FILE-NAME', file.name);
xhr.send(file);
Shaunak D
  • 20,588
  • 10
  • 46
  • 79
Arshak
  • 61
  • 7

2 Answers2

4

This is a known bug for Chrome on iOS, it doesn't support progress update. More details here: https://github.com/blueimp/jQuery-File-Upload/wiki/Browser-support

Also, I have reported the bug to the official bug tracker, you can see the latest updates here

UPDATE 2016: It has been fixed!

wont_compile
  • 855
  • 2
  • 17
  • 43
0

I have come across the same problem using plupload. However, it only occurred when allowing the user to select multiple files. After turning off this ability, chrome would correctly upload the files.

I have not found a solution to the problem that also allows multiple file upload.

Graham
  • 23
  • 4