How to check if file is selected
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 (is开发者_开发技巧set($fileImage))
and if (empty($fileImage))
are not working. One of them always returns true value, but other always returns false value.
Check file size:
if($_FILES['fileCatImg']['size'] > 0) { ... }
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.
精彩评论