Closed xtianus closed 5 years ago
hmm, you are right... Just tested the native behavior on FF, chrome & safari. what a strange behavior i think.
Figured if someone mutate the window.File
(or blob) and you want to restore it you could always do this
window.File = 'Meh!'
form = document.createElement('form')
form.innerHTML = '<input type=file name=foo>'
window.File = new FormData(form).get('foo').constructor
file = new File(['abc'], 'sample.txt') // works again!
Weird...
When I send a form in Chrome, empty file fields are sent with the multipart request:
------WebKitFormBoundaryWyYGnblSdE4D3eyO Content-Disposition: form-data; name="segmentationFile"; filename="" Content-Type: application/octet-stream
When I use the polyfill in Safari, the empty fields are ignored and not sent with the request at all. Is this the expected behavior? This forces me to check for null entries on the server when the request comes from Safari. From Chrome I'd have a non-null zero-length entry.