I have got an input file upload , need to check which file is uploaded / if no file is selected by the client using jquery.
<input type="file" name="files" id="file1" style="color:White" />
<input type="submit" value="Create" />
The check should trigger when submit is clicked.
This demo works in IE9 + Chrome:
using Jquery, you get the val();
a quick implementation here:
Have you made any attempt at doing this?
Testing for...
...is working for me in Chrome. The jQuery is actually not even necessary as the raw HTML element (returned by the
[0]
on the jQuery object) gives access to the files list.See the sample I have created:
http://jsfiddle.net/G7xke/
And JavaScript: