php文件上传,该如何处理
程序员文章站
2024-01-11 17:25:46
...
php文件上传
Notice: Undefined index: file in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\updoad-file.php on line 3 Notice: Undefined index: file in C:\Program Files\Apache Softw are Foundation\Apache2.2\htdocs\updoad-file.php on line 9 Upload:
Notice: Undefined index: file in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\updoad-file.php on line 10 Type:
Notice: Undefined index: file in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\updoad-file.php on line 11 Size: 0 Kb
Notice: Undefined index: file in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\updoad-file.php on line 12 Stored in:
怎么一直提示这个,不懂,求教!!!!
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "
";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "
";
echo "Type: " . $_FILES["file"]["type"] . "
";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb
";
echo "Stored in: " . $_FILES["file"]["tmp_name"];
}
?>
------解决方案--------------------
表单文件控件的name不是file吧?
------解决方案--------------------
检查一下php.ini,看看是否允许上传文件(file_uploads = On)。
------解决方案--------------------
除了name以外其他几个都没有值,应该是上传未完成php就执行了
传送的文件太大了?
------解决方案--------------------
表单:
Notice: Undefined index: file in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\updoad-file.php on line 3 Notice: Undefined index: file in C:\Program Files\Apache Softw are Foundation\Apache2.2\htdocs\updoad-file.php on line 9 Upload:
Notice: Undefined index: file in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\updoad-file.php on line 10 Type:
Notice: Undefined index: file in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\updoad-file.php on line 11 Size: 0 Kb
Notice: Undefined index: file in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\updoad-file.php on line 12 Stored in:
怎么一直提示这个,不懂,求教!!!!
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "
";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "
";
echo "Type: " . $_FILES["file"]["type"] . "
";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb
";
echo "Stored in: " . $_FILES["file"]["tmp_name"];
}
?>
------解决方案--------------------
表单文件控件的name不是file吧?
------解决方案--------------------
检查一下php.ini,看看是否允许上传文件(file_uploads = On)。
------解决方案--------------------
除了name以外其他几个都没有值,应该是上传未完成php就执行了
传送的文件太大了?
------解决方案--------------------
表单:
专题推荐
-
独孤九贱-php全栈开发教程
全栈 170W+
主讲:Peter-Zhu 轻松幽默、简短易学,非常适合PHP学习入门
-
玉女心经-web前端开发教程
入门 80W+
主讲:灭绝师太 由浅入深、明快简洁,非常适合前端学习入门
-
天龙八部-实战开发教程
实战 120W+
主讲:西门大官人 思路清晰、严谨规范,适合有一定web编程基础学习
上一篇: 通过html表格发电子邮件_php基础
网友评论
文明上网理性发言,请遵守 新闻评论服务协议
我要评论