Reputation: 26501
I have file $fileImage = $_FILES['fileCatImg'];
, everything works when I try to upload it, but how do I check if file is selected first? if (isset($fileImage))
and if (empty($fileImage))
are not working. One of them always returns true value, but other always returns false value.
Upvotes: 3
Views: 3315
Reputation: 31637
No file was uploaded when $_FILES['fileCatImg']['error'] == UPLOAD_ERR_NO_FILE
, but that is only useful to determine an appropriate error message. See Error Messages Explained for other values that $_FILES['fileCatImg']['error']
might assume when something goes wrong during file uploads.
Upvotes: 1