开发者

upload a javascript File object through an iFrame

开发者 https://www.devze.com 2023-04-07 03:47 出处:网络
I\'m trying to create a drag and drop file upload UI. The problem is that 开发者_运维问答I have to submit the files using an old fashioned multipart form. Is it possible to take the File objects you g

I'm trying to create a drag and drop file upload UI. The problem is that 开发者_运维问答I have to submit the files using an old fashioned multipart form. Is it possible to take the File objects you get from a drop event and somehow insert them into a form so they can be submitted to an iFrame like file inputs?


If you have to submit via a multi-part form, then no, there's no cross-browser way to do this. Browsers will not let JavaScript code update the value of any "file" input elements, for reasons that should be obvious (security - if your code code set a "file" input to any path, well ...).

There are newer ways of handling files, but in general there's still no way to create or copy a "file" element with a value.

0

精彩评论

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

关注公众号