Reputation: 14285
How can we set text in html file uploader.
Is it possible using JavaScript?
Upvotes: 1
Views: 2872
Reputation: 9814
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'>"
Upvotes: 0
Reputation: 943185
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">
Upvotes: 4