How can I validate if the user has selected a file to upload?
Edit: bumped
Building on Ravinders solution, this code stops the form being submitted. It might be wise to check the extension at the server-side too. So you don't get hackers uploading anything they want.