如何检查$ _FILE是否在php中设置? [英] how to check if a $_FILE is set in php?
本文介绍了如何检查$ _FILE是否在php中设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用3个< input type ="file"/>
我看到我得到了一个带有 array(name =>")
的数组.
I see that I get an array with array(name=>"")
.
所以我改为检查是否($ _FILE ["myfilename"] ["name"] ==")
.
这有效,但对我来说似乎很不寻常.
This works but it seems rather unusual to me.
我想知道是否有更好的方法来检查是否设置了文件输入?
I was wondering if there was a better way to check if a file input is set or not?
推荐答案
有: is_uploaded_file()
.处理上传的文件时,应始终使用它(及其表亲 move_uploaded_file()
)出于安全原因.
There is: is_uploaded_file()
. When dealing with uploaded files, you should always use it (and its cousin move_uploaded_file()
) for security reasons.
这篇关于如何检查$ _FILE是否在php中设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文