webkitSlice breaks HTML5 + chunking on Android Browser #613

inghamc opened this Issue Aug 21, 2012 · 7 comments


None yet
3 participants

inghamc commented Aug 21, 2012

ASUS Transformer running Andoid 4.0.3

User Agent: Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; Transformer TF101 Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30

Plupload 1.5.4

After extensive testing and debugging I have determined that any upload attempt involving chunking under HTML5 on the Android browser fails. More specifically, any path within plupload.html5.js that involves Blob.webkitSlice(start, end) fails.

After calling webkitSlice(start, end), the returned blob reports the correct .size, but when added and POSTed to the server using FormData.append() and xhr.send(formData), 0 bytes of binary data are included in the POST.

Working around this issue required loading the entire file using FileReader.readAsBinaryString(File/Blob) via the readFileAsBinary function. This code fragment shows context starting at line 755 with lines 758-760 modified to sniff for and handle Android as though it has no chunking support:

                // if there's no way to slice file without preloading it in memory, preload it
                } else if (!features.chunks && features.jpgresize) {
                    readFileAsBinary(nativeFile, sendBinaryBlob);
                } else {
                    var isAndroid = navigator.userAgent.toLowerCase().indexOf('android') > -1;
                    if (isAndroid) {
                        console.debug("Android workaround: avoiding blob.webkitSlice with readFileAsBinary(nativeFile, sendBinaryBlob)");
                        readFileAsBinary(nativeFile, sendBinaryBlob);
                    } else {

I would hugely appreciate if either the authors or forum readers could offer a better workaround (or challenge my findings). Otherwise, hopefully this workaround is helpful to others and could be included in a future Plupload release. I'm also trying to get my hands on a Nexus 7 tablet or similar to find an Android browser version that doesn't have this issue.


jayarjo commented Jan 26, 2013

It might be possible to slice off the chunk, preload it with FIleReader and send as binary. I had something similar for Gecko 2,5,6, which had a similar problem with FormData and Blobs.


jayarjo commented Feb 21, 2013

Addressed this in Plupload 2 code base. Actually this should be easy to backport to 1.x branch as well, as the code for workaround is already present there.


I use the latest stable version (1.5.6) of Plupload and I'm blocked by this bug :(
Have you planned to backport this fix in a 1.5.x release ? When version 2 will be released ?

Thanks for your good work ! ;)


jayarjo commented Mar 5, 2013

Stable Plupload 2 is going to come out this week (at least scheduled). Actually it was backported to 1.5.6. Maybe you are affected by a different bug? Post your config please.

Hmmm... It's weird...
Anyway I am testing the Plupload 2 beta and it's working fine. So I will wait its stable release this week.



jayarjo commented Aug 11, 2013

Ouch... overdue by 5 months. Crap. Need to push it out ASAP.

@jayarjo jayarjo closed this Aug 11, 2013

Any news about the Plupload 2 release ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment