Closed ArtNattapat closed 6 years ago
Thanks for the PR 🙂
A heads-up that I won't have the time to properly review this for at least the next few days.
A brief, but related conversation: https://github.com/jaydenseric/apollo-upload-client/issues/28#issuecomment-320863665.
ie11 and edge can't create file with new File(['test file'], 'test.txt') i think this just workaround for ie11 and edge(not support too) if need to upload blob. or will be a shorthand upload by blob (not need to new File()). but disadvantage on Blob is have no filename, and mine type like you told on related conversation.
my english is not good, sorry 🙁
That's ok about the english 🙂
Because blobs are a little different to files this PR needs to be closely reviewed and tested across 4 related packages (extract-files
, apollo-upload-client
, apollo-fetch-upload
, apollo-upload-server
). Documentation across all would need to be updated. I am spread really thin for time right now, and because I don't need to support blobs for current deadlines this will just have to wait a while to be merged.
I got it. thank you ^^
It seems I need Blob support too. I'm building a File object manually (from data URI after cropping an image), not using one from the File API.
Here's a minimal case that illustrates the problem. I found that the following seems to work in Chrome but not in Webkit:
var fd = new FormData();
fd.append('foo', new File(['abcd'], 'foo'));
fetch('http://mockbin.org/echo', {method:'POST', mode: 'cors', body: fd});
In Webkit, the 'foo' part body is empty.
However this works in both (using Blob instead of file):
var fd = new FormData();
fd.append('foo', new Blob(['abcd']));
fetch('http://mockbin.org/echo', {method:'POST', mode: 'cors', body: fd});
I've been crazy busy with gen 2 uploads, which are are now in alpha. Other than preparing stable releases, this, along with https://github.com/jaydenseric/extract-files/issues/3 is my next priority.
Thanks for looking into this, I tried to merge this before https://github.com/jaydenseric/extract-files/pull/5 so you would be included in the contributors list, but there were too many conflicts with the current master
branch. Blob
support is on the way!
IE11 not support new File(). must use Blob instead.