php文件上传,该如何处理
php文件上传Notice: Undefined index: file in C:\Program Files\Apache Software Foundation\Apache2.2\h
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:
怎么一直提示这个,不懂,求教!!!!
<?php
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Stored in: " . $_FILES["file"]["tmp_name"];
}
?>
[解决办法]表单文件控件的name不是file吧?
<input type="file" name="file" id="file" />
[解决办法]检查一下php.ini,看看是否允许上传文件(file_uploads = On)。
[解决办法]除了name以外其他几个都没有值,应该是上传未完成php就执行了
传送的文件太大了?
[解决办法]表单:
<form enctype="multipart/form-data" action="updoad-file.php" method="post">
<input type="hidden" name="max_file_size" value="100000">
php.ini里也要设置下. file_uploads = On。