How to check an input type="file" has a file or not using jquery?

ACP picture ACP · Apr 15, 2010 · Viewed 30.5k times · Source

I have a file upload control <input id="File1" type="file" /> in my page... How to check an input type="file" has a file or not using jquery on click of a button upload?

Answer

Quentin picture Quentin · Apr 15, 2010
if (jQuery('#File1').val()) { /* There are files */ }