如何检查文件字段是否为空? [英] how to check if the file field is empty?
本文介绍了如何检查文件字段是否为空?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我很难用 $ _ FILES
我想检查它是否为空,如果它不是空的,那么它不应该尝试上传文件。如何检查这个?
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?
推荐答案
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
}
这篇关于如何检查文件字段是否为空?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文