简体   繁体   中英

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"> .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM