Php image Upload failure source image _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Php fails to upload the source image. Php fails to upload the original image, unless the file is small. like a 5 MB file, it may take more than one minute to complete the upload. however, in php, the longest execution time of this page is default. An error occurred while uploading the image in php.

Generally, unless the file is very small, it is like a 5 MB file. it may take more than one minute to complete the upload.
However, in php, the longest execution time of the page is 30 seconds by default. that is to say, the script is stopped after 30 seconds.
This causes the web page to fail to be opened. in this case, we can modify max_execution_time.

Search in php. ini
Max_execution_time
The default value is 30 seconds.
Max_execution_time = 0
0 indicates no limit

Another way is to add
Set_time_limit ();
To set the longest page execution time.
Set_time_limit (0); // 0 indicates no limit

2. modify post_max_size to set the maximum size allowed by POST data. This setting also affects file upload.
The default post_max_size of php is 2 MB. if the size of POST data is larger than that of post_max_size $ _ POST and $ _ FILES superglobals, it is null.
Change to post_max_size.
Post_max_size = 150 M

3. many people will change the second step. but the maximum size of the file to be uploaded is 8 MB.
Why? we need to change the parameter upload_max_filesize to indicate the maximum size of the uploaded file.
Find upload_max_filesize. the default value is 8 MB.
Upload_max_filesize = 100 M

In addition, post_max_size is better than upload_max_filesize.

Upload an ordinary file, unless the file is small. like a 5 MB file, it may take more than one minute to complete the upload. but in php, the longest execution time of this page is by default...

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.