Mohamed Hassan Mohamed Hassan - 10 months ago 33
PHP Question

how to check if the file field is empty?

I am having a hard time using


I want to check if it's empty or not and if it's not empty then it shouldn't try and uploading the file. How do I check this?

if($_FILES["file"]["error"] != 0) {
//stands for any kind of errors happen during the uploading

also there is

if($_FILES["file"]["error"] == 4) {
//means there is no file uploaded