Home >Backend Development >PHP Tutorial >PHP failed to upload image original image_PHP tutorial

PHP failed to upload image original image_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:52:151079browse

php failed to upload image original image

General file upload, unless the file is very small. Like a 5M file, it will probably take more than a minute to upload.
But in PHP, the default maximum execution time of this page is 30 seconds. That is to say, if it exceeds 30 seconds, the script will stop executing.
This results in the inability to open the web page. At this time we can modify max_execution_time

Find
in php.ini max_execution_time
The default is 30 seconds. Change to
max_execution_time = 0
0 means no limit

Another method is to add
in the php program set_time_limit();
To set the maximum execution time of the page.
set_time_limit(0);//0 means no limit

2. Modify post_max_size to set the maximum size allowed for POST data. This setting also affects file uploads.
PHP's default post_max_size is 2M. If the POST data size is greater than post_max_size $_POST and $_FILES superglobals will be empty.
Find post_max_size .Change to
post_max_size = 150M

3. Many people will change the second step. But when uploading files, the maximum size is still 8M.
Why? We also need to change a parameter upload_max_filesize to indicate the maximum size of the uploaded file.
Find upload_max_filesize, the default is 8M and changed to
upload_max_filesize = 100M

Another thing to note is that post_max_size is better than upload_max_filesize.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632491.htmlTechArticlephp failed to upload the image. The original image is a normal file upload, unless the file is very small. Like a 5M file, it is very It may take more than a minute to upload. But in php, the default longest execution time of this page...
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