PHP modified upload file size (max_execution_time post_max_size)

Source: Internet
Author: User


Some friends to through their own website backstage, including the forum, to upload some files, PHP is generally 2m, or 8m (below we press the default is 2m), next is how to modify the upload file size.


1. First modify the upload file limit


Generic file uploads, unless the file is small. Like a 5M file, it's likely to take more than a minute to upload.

In PHP, however, the default maximum execution time for this page is 30 seconds. That means more than 30 seconds, the script stops executing.

This results in a situation where the Web page cannot be opened. Then we can modify the Max_execution_time


Look in the php.ini.

Max_execution_time

The default is 30 seconds. Change to

Max_execution_time = 0

0 means no Limit


Another way is to add a PHP program to the

Set_time_limit ();

To set the longest execution time of the page.

Set_time_limit (0);//0 says there is no limit


2. Next change the maximum limit of the packet


Modify Post_max_size to set the maximum allowable size for post data. This setting also affects file uploads.

PHP default post_max_size is 2M. If the POST data size is larger than post_max_size $_post and $_files superglobals will be empty.

Find Post_max_size. instead

Post_max_size = 150M


3. It is best to modify the maximum upload file limit


A lot of people will change the second step. However, the maximum number of files uploaded is still 2M.

Why, we're going to change one. The parameter upload_max_filesize indicates the maximum size of the uploaded file.

Find Upload_max_filesize, default to 8M instead

Upload_max_filesize = 100M


It is also stated that the post_max_size is better than upload_max_filesize


2009-03-24


This article is from the "Five Corners" blog, please be sure to keep this source http://ttl289.blog.51cto.com/4513812/1753678

PHP modified upload file size (max_execution_time post_max_size)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.