![](/img/trans.png)
[英]How to set uploaded file's name to an input type:text on javascript in html
[英]How to set text in file (html input type)
我們如何在html文件上傳器中設置文本。
可以使用JavaScript嗎?
你不能。 value屬性被忽略,DOM值屬性是readonly。
否則<input style="display: none" type="file" name="mine-now" value="path-to-some-common-sensitive-file">
您無法設置此項(安全原因 - 只有用戶可以在瀏覽器中選擇文件),但如果您需要,可以使用以下腳本清除此字段:
$ get('FileUploadCtrlId')。outerHTML =“<input type = file style ='WIDTH:400px'id ='FileUploadCtrlId'>”
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.