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.
精彩评论