开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜