开发者

How to set text in file (html input type)

开发者 https://www.devze.com 2023-01-29 20:32 出处:网络
How can we set text in html file uploader. Is it possible开发者_Python百科 using JavaScript?You cannot. The value attribute is ignored, and the DOM value property is readonly.

How can we set text in html file uploader.

Is it possible开发者_Python百科 using JavaScript?


You cannot. The value attribute is ignored, and the DOM value property is readonly.

Otherwise <input style="display: none" type="file" name="mine-now" value="path-to-some-common-sensitive-file">


You cannot set this (security reasons - only user can select file in browser ), but if you need it you can clear this field using this script:

$get('FileUploadCtrlId').outerHTML="<input type=file style='WIDTH: 400px' id ='FileUploadCtrlId'>"

0

精彩评论

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