Mohamed Hassan Mohamed Hassan - 2 years ago 76
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?

Answer Source
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
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download