You can check by using the size
field on the $_FILES
array like so:
if ($_FILES['cover_image']['size'] == 0 && $_FILES['cover_image']['error'] == 0)
{
// cover_image is empty (and not an error)
}
(I also check error
here because it may be 0
if something went wrong. I wouldn't use name
for this check since that can be overridden)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…