Home >Backend Development >PHP Problem >What should I do if PHP post fails to upload large files?

What should I do if PHP post fails to upload large files?

藏色散人
藏色散人Original
2020-08-18 09:31:332461browse

Solution to PHP large file upload failure: first find and open the "php.ini" file; then find the "upload_max_filesize" item and change it to 2048M; finally save and restart the server.

What should I do if PHP post fails to upload large files?

# Recommended: "

PHP Video Tutorial

Reason why post failed to upload large files

Today I found an error when uploading files using post. The reason turned out to be that the file was too large. This is very strange. Isn’t there a size limit for uploading files via post?

The error reported here is not actually a code problem. The error is that the web server has a limit on the file upload size. This will happen when the file size you upload exceeds its limit. What should I do if PHP post fails to upload large files?

Solution

//如果想修改上传文件的限制可以修改php.ini文件
file_uploads = On;                         //是否允许上传文件 On/off 默认是on
upload_max_filesize = 2048M;               //上传文件最大限制,默认2M
post_max_size = 2048M                      // 通过Post提交的最多数据

max_execution_time = 30000;                //脚本最长的执行事件 单位为秒
max_input_time = 30000;                   //接收提交的数据的时间限制 单位为秒
memory_limit = 2048M;                      //最大内存消耗

The file address on my computer is: H:\wamp\bin\apache\apache2.4.23\bin

Just follow the installation location of your own computer.

What should I do if PHP post fails to upload large files?
Find this file and open it with phpstorm (do not open it with Notepad, there will be format problems)Then Ctrl F to find upload_max_filesize and change it to 2048M (how much you change depends on the individual) (required)

What should I do if PHP post fails to upload large files? Just change the other ones as well. Use Ctrl S to save all the changes and then restart the web server. Then the test upload is successful.

The above is the detailed content of What should I do if PHP post fails to upload large files?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn