Is it possible to add or modify multipart/form-data headers to emulate a <input type="file"> element?
Specifically I'd like to be able to set the Content-Disposition
and Content-Type
headers for a specific input field to look like a type="file" input field, e.x.
Content-Disposition: form-data; name="myformfile"; filename="myfile.jpeg"
Content-Type: image/jpeg
I w开发者_如何转开发ant to do this on an existing HTML form, not by manually formatting an XMLHttpRequest body.
(The use case is in a browser extension / userscript, to replace a file upload button with one the extension can programmatically set)
精彩评论