Click Upvote Click Upvote - 2 years ago 147
Javascript Question

How to validate a file upload field using Javascript/jquery

How can I validate if the user has selected a file to upload?

Edit: bumped

Answer Source

Check it's value property:

In jQuery (since your tag mentions it):


Or in vanilla JavaScript:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download