Closed creeperyang closed 4 years ago
I'm using chrome (v52) and does not see such effect.
case:
let file = input.files[0];
let data = new FormData();
data.append('photo', photo);
fetch(`url`, {
method: 'POST',
body: data
});
request:
------WebKitFormBoundary76WmHIDQOjBC1dKX
Content-Disposition: form-data; name="photo"; filename="___.jpg"
Content-Type: image/jpeg
File name is in place.
Um, It's chrome v46/v48 (v40+, not v50+) when I report this issue.
Maybe things changed when chrome updated.
@creeperyang can you try it and report back when you can?
cause this issue, because the third argument does not set
formdata.append('blobdata', blob, filename);
This looks like to be a client side issue
What I upload:
The problem is that when handle
File
and ouput aBlob
instance, and then upload this blob, the filename's extension will lost (client only sentfilename="blob"
).So the
IncomingForm.prototype._fileName
will return"blob"
as thefile.name
.And
IncomingForm.prototype._uploadPath
will generate path without extension (althoughthis.keepExtensions
istrue
) and all saved files lost their extension.I'm not sure it's a better way to retrieve and add extension from
Content-Type: image/jpeg
, or just leave it with no extension.