Home >Backend Development >PHP Tutorial >Detailed example of modifying upload file size limit in php

Detailed example of modifying upload file size limit in php

高洛峰
高洛峰Original
2017-01-14 14:12:011160browse

1. Modify max_execution_time

In PHP, the default maximum execution time of a page is 30 seconds. If it exceeds 30 seconds, the script will stop executing.
This will cause the web page to be unable to be opened. .At this time we can modify max_execution_time
Look for

max_execution_time

in php.ini. The default is 30 seconds. Change it to

max_execution_time = 0

0 means no limit

2. Modify post_max_size

post_max_size Set the maximum size allowed for POST data. This setting also affects file uploads.
The default post_max_size of php is 2M. If the POST data size is greater than post_max_size $_POST and $_FILES superglobals will be empty.
Find post_max_size and change it to

post_max_size = 150M

3 . Modify upload_max_filesize

upload_max_filesize indicates the maximum size of the uploaded file.

Look for upload_max_filesize, the default is 8M and change it to

upload_max_filesize = 100M

In addition, it should be noted that post_max_size is better than upload_max_filesize.

Thanks for reading, I hope it can help everyone, thank you for your support of this site!

For more detailed examples of how to modify the size limit of uploaded files in PHP, please pay attention to the PHP Chinese website for related articles!

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