-
-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
as file name is Blob in IE #43
Comments
Old ie don't have Symbol.toStringTag and the polyfill was therefore not able to change the I changed the way it checks if it's a "File" so it return the correct filename. Maybe cold have be fixed if the Symbol polyfill was included, but not sure. Could be nice to include since it contains toStringTag and entries which formdata also uses to be able to do |
still doesn't work ( [object File].toString() is [object Blob] :( & i don't know why it would by possible instead of this part return value instanceof Blob
// normalize name and filename if adding an attachment
? [name + '', value, filename !== undefined
? filename + '' // Cast filename to string if 3th arg isn't undefined
: type(value) === 'File' // if it's a File
? value.name // Use File.name
: 'Blob'] // otherwise fallback to Blob
// If no attachment, just cast the args to strings
: [name + '', value + ''] give return value instanceof Blob
// normalize name and filename if adding an attachment
? [name + '', value, filename !== undefined
? filename + '' // Cast filename to string if 3th arg isn't undefined
: value.name // if object (File) have name prop
? value.name // Use File.name
: 'Blob'] // otherwise fallback to Blob
// If no attachment, just cast the args to strings
: [name + '', value + ''] |
Guess we could take the name property without checking if it's a file But i will change it to this: return value instanceof Blob
// normalize name and filename if adding an attachment
? [name + '', value, filename !== undefined
? filename + '' // Cast filename to string if 3th arg isn't undefined
: value.name || 'Blob'] // otherwise use File's name or fallback to Blob
// If no attachment, just cast the args to strings
: [name + '', value + ''] |
nice, thanks |
or maybe not... Trying this out in chrome yeilds fd = new FormData()
fd.append('f', new File([], ''))
console.log([...fd][0][1]) |
maybe need to check at least if it's a string return value instanceof Blob
// normalize name and filename if adding an attachment
? [name + '', value, filename !== undefined
? filename + '' // Cast filename to string if 3th arg isn't undefined
: typeof value.name === 'string' // if object (File) have name prop
? value.name // Use File.name
: 'Blob'] // otherwise fallback to Blob |
this solution ...
: typeof value.name === 'string'
... it works in both chrome and ie, for me |
There u go, publish 3.0.9 |
Curious doe...
What did you do to make this happened? Would like a to build a test for this. |
Dose this fail to override toString in IE? var blob = new Blob()
Object.defineProperties(blob, {
toString: {
value: function() {
return '[object File]'
}
}
})
console.log(blob.toString()) |
it finally works, thank you so much ;) |
about that toString() problem, i thing that problem IE |
lol, tried it myself in browserstack so wierd |
sometimes, whole IE is weird :) |
if i append File to FormData and after get filename
i get
Blob
...
i found
i print value of param
a
is[object File]
, but Object.prototype.toString.call(a) is[object Blob]
if return change to
and i get real name
The text was updated successfully, but these errors were encountered: