当我通过简单的形式上传文件时,我得到了
Warning: POST Content-Length of 372220927 bytes exceeds the limit of 33554432 bytes in Unknown on line 0
Notice: Undefined index: file in C:\xampp\htdocs\php_upload\upload_file.php on line 3
我将 php_ini 更改为 20M,我的问题是我想回显关于文件太大的好消息错误,没有这样的警告。我可以尝试/捕获的错误/执行。在打电话之前我可以在哪里找到有关“警告”的信息:
$_FILES["文件"]["错误"]>0
<form action="upload_file.php" method="post"
<form action="upload_file.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label></br>
<input type="file" name="file" id="file"></br>
<input type="text" name="desc" id="desc"></br>
<input type="submit" name="submit" value="Submit">
</form>
//
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"];
}