Home  >  Article  >  Backend Development  >  How to modify the upload file size limit using php

How to modify the upload file size limit using php

不言
不言Original
2018-06-21 15:10:431909browse

This article mainly introduces how to use php to modify the size limit of uploaded files. It has certain reference value. Now I share it with you. Friends in need can refer to it.

By default, php only Files of a certain size are allowed to be uploaded. When the uploaded file size exceeds this value, an error will occur. This article will explain to you how to modify the upload file size limit in php.ini. There are three settings that need to be modified, please see below

1. Modify max_execution_time

In php, the default maximum page execution time is 30 seconds, if it exceeds 30 seconds, the script will stop executing.
In this case, the web page will not be opened. At this time, we can modify max_execution_time
Look for it in php.ini

max_execution_time

The default is 30 seconds. Change to

max_execution_time = 0

0 means no limit

2. Modify post_max_size

post_max_size sets 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 larger than post_max_size $_POST and $_FILES superglobals will be empty.
Look for 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

Another thing to note is that post_max_size is greater than upload_max_filesize Best.

The above is the entire content of this article. I hope it will be helpful to everyone's study. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

About the simple architecture of webservice implementation in PHP

Analysis of ThinkPHP conventional configuration files

The above is the detailed content of How to modify the upload file size limit using php. 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