Closed sjonnet19 closed 12 years ago
BlobBuilder.js fake blobs are only intended to be used with URL.createObjectURL()
, and the XHR2 API expects a real blob or string. Do this:
if (blob.fake) {
request.send(blob.data);
} else {
request.send(blob);
}
Thanks
Sorry to bug you but that didn't work :(
This is with Safari 5.1.2
I am attempt to take a Blob I created from a string using the BlobBuilder and send it as a file in FormData
fd.append('fileToUpload', blob.fake ? blob.data: blob)
That's odd. I can't reproduce your issue in Safari 5.1.1 FormData. Maybe your server isn't handling it correctly if fileToUpload is a String instead of a File/Blob with a filename, etc.
How should it handle it... I added logic to detect if it was a string and save it but the string when returned has some differences in it
Same issue.
My original solution to upload a canvas image was toDataURL -> Uint8Array -> BlobBuilder -> Blob -> FormData, which works perfectly except on Safari (tested on 5.1 and whatever version is on the iPhone 4GS). Unfortunately the BlobBuilder shim is incompatible with FormData.
XHR2 FormData with BlobBuilder for CSS upload of a file in memory
I have this working in Firefox and Chrome but am unable to get this to work in Safari even using you pollyfill.
Can you provide any help / advice.