HTML form and a file element
Is is possible to insert value in an input element of a html form if the element is of type "file"? How to do so,开发者_开发问答 if it is possible?
No, sorry, JavaScript is very careful about what it allows a developer to do with this input element, think of the ways it could be exploited with some tricky CSS. Someones computer could be forced into giving up sensitive or private data if the user is unaware that they are actually uploading a file to the server.
Here is something from RFC 1867:
It is important that a user agent not send any file that the user has not explicitly asked to be sent. Thus, HTML interpreting agents are expected to confirm any default file names that might be suggested with
<INPUT TYPE=file VALUE="yyyy">
.
精彩评论