如果($ _ FILES ['files'] ['name']!="")运行if文件,如果没有文件头痛就不要运行 [英] if($_FILES['files']['name']!="") run if files, don't run if no files headache
问题描述
我的其他线程与特定代码没有任何运气,所以如果我可以,我想询问人们如何让这个工作。
Not having any luck with my other thread with specific code so if I can I'd like to ask how people would go about getting this to work.
I有一个页面,我的客户编辑属性列表中显示的属性的详细信息,比如他们编辑文本,不要向此属性添加任何图像。
I have an page where my client edits details of a property displayed on a property list, say they edit text and don't add any images to this property.
HTML表单工作好的,我只是在看php。
HTML form works fine, I'm just looking at the php.
示例:
If files selected then run this script as an include
If no files selected then exit
像这样......
if($_FILES['files']['name']!="")
{
Do this
}
else
{
exit();
}
我正在努力解决这个问题,所以任何帮助或建议都会太棒了我已经在这些变化之上尝试了一些变化和变化,到目前为止似乎没有任何工作。
I'm going mental trying to figure this out so any help or suggestions would be great. I have tried a few variations and variations on top of those variations and nothing seems to work so far.
干杯
推荐答案
使用 isset()
或 empty()
构造。 (有关更多信息,请阅读PHP文档)
Use isset()
orempty()
constructs. (For more information read PHP doc)
if(!empty($_FILES['files']['name']))
{
//
}
这篇关于如果($ _ FILES ['files'] ['name']!="")运行if文件,如果没有文件头痛就不要运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!