Home >Backend Development >PHP Tutorial >PHP cannot upload large files and displays the solution 'File couldn't be moved'_PHP Tutorial

PHP cannot upload large files and displays the solution 'File couldn't be moved'_PHP Tutorial

WBOY
WBOYOriginal
2016-07-21 14:54:201032browse

I am building a file upload sharing website and want to implement the file upload function through the following code:



Fill out the form to upload a file:

for ($i = 0; $i < $counter; $i++) {
echo '< ;p>File:


< b>Description:


';
}
?>




But I found that when uploading a slightly larger file, File couldn't be moved was displayed. However, the file name was displayed in the database, but the size was not displayed. When uploading files larger than 8M, the page does not respond at all. After searching online, I found an article on "Summary of PHP upload problems" on Feinuo.com. The article points out that PHP file upload is affected by the following settings in php.ini:

post_max_size
upload_max_filesize
max_execution_time
memory_limit

So I found php.ini under /etc/php5/apache2/, searched for post_max_size and changed its default value to 125M, searched for upload_max_filesize and changed its default value to 125M, and saved it. Enter in the terminal: apache2ctl -k restart Restart apache, the problem is solved! You can upload large files on the page at will ~

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/364596.htmlTechArticleI am building a file upload sharing website and want to implement the file upload function through the following code: form enctype=multipart/form- data action=add_file.php method=post fieldsetlegendFill out t...
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