简体   繁体   English

在php.ini中更改文件上传限制大小后,仍然不起作用

[英]after changing the file upload limit size in php.ini, still doesn't work

I want to upload the file to my local server, but only small size files worked, if the file size exceeds certain value, then it can not find the uploaded file. 我想将文件上传到本地服务器,但是只有小文件可以工作,如果文件大小超过一定值,则找不到上载的文件。

if (isset($_FILES["fileToUpload"]["tmp_name"])) {
  $fileUploaded = move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], "./uploads/".$_FILES["fileToUpload"]["name"]);
} else {
  die("Error uploading file.  Please contact an administrator");
} 

Then I changed the upload_max_filesize and post_max_size in php.ini, restart apache, but the problem still exists, couls you help me on that? 然后我在php.ini中更改了upload_max_filesize和post_max_size,重新启动apache,但是问题仍然存在,可以帮我吗? thanks so much. 非常感谢。

update: 1. only one file will be uploaded. 更新:1.将仅上传一个文件。 2. Small-size file like less than 2 MB could be uploaded successfully. 2.小​​于2 MB的小文件可以成功上传。 I tested an 10 MB file, it failed. 我测试了一个10 MB的文件,但失败了。 3. I changed the two parameters upload_max_filesize and post_max_size from 2 MB to 100 MB. 3.我将两个参数upload_max_filesize和post_max_size从2 MB更改为100 MB。

So you can see what actual error is being generated try this code 因此,您可以查看正在生成什么实际错误,请尝试以下代码

if ( isset($_FILES["fileToUpload"]) ) {
    print_r($_FILES);
}

Then look at the [error] array and see what error is actually being reported. 然后查看[error]数组,看看实际上正在报告什么错误。

Then check this page in the manual to see what the numbers mean. 然后在手册中查看此页面以查看数字的含义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM