How to limit the size of uploaded files in php

怪我咯
Release: 2023-03-12 22:36:01
Original
2193 people have browsed it

Sometimes you need to use php to upload relatively large files. This is not possible by default and must be modified according to the following method.

Configure the php.ini file (taking uploading files below 500M in size as an example)
Find the following options and modify them ->
file_uploads = On ;OpenFile uploadOption
upload_max_filesize = 500M;Upload file upper limit

If you want to upload a relatively large file, the above two are not enough, you must add the serverCache Increase the upper limit and lengthen the maximum execution time of the script
post_max_size = 500M; post upper limit
max_execution_time = 1800; Maximum execution time of each script, in seconds Maximum execution time of script Time
max_input_time = 1800; Maximum amount of time each script may spend parsing request data
memory_limit = 128M; Maximum amount of memory a script may consume (128MB)Memory upper limit

The above is the detailed content of How to limit the size of uploaded files in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!