I’m writing a script to handle a file upload. I’ve got the script in place, validating and uploading correctly.
But….the upload is optional. When I submit the form, the $_FILES[‘field_name’] is always present which consequently forces my validation to kick in.
How can I detect if there is a file upload or not?
You could use :
Which amounts to (almost) the same as the other answers on here.