开发者

Is it possible to add or modify multipart/form-data headers to emulate a <input type="file"> element?

开发者 https://www.devze.com 2023-03-19 12:37 出处:网络
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.

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)

0

精彩评论

暂无评论...
验证码 换一张
取 消