jQuery: Simple Validate of a File Upload Field Programming 08 JUL 2009


How do I validate if a user has selected a file to upload before submitting my upload form?


Simply check that it’s value contains something. In other words check:

//or else in plain vanilla javascript check:

Useful to remember.

jquery logo

About Craig Lotter

Software developer, husband and dad to two young ladies. Writer behind An Exploring South African. I don't have time for myself any more.