Skip to content Skip to sidebar Skip to footer

How Can I Have A Preselected Input For When Type="file"?

Note: The answers & comments below reflect the state of legacy browsers in 2009. Now you can actually set the value of the file input element dynamically/programatically using

Solution 1:

With input type file it isn't possible to set up a default value. You have to use some plugins e.g. http://blueimp.github.io/jQuery-File-Upload/

Read following article How to set a value to a file input in HTML?

Solution 2:

That's impossible to set a selected file by default. It against the security policy. If you want to keep previously selected file, you should not reload the page. Submit your form using ajax and you will keep your file selected so you can submit it again or do whatever you want

Post a Comment for "How Can I Have A Preselected Input For When Type="file"?"