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.
# 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.
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; //最大内存消耗
Just follow the installation location of your own computer.
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)
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!