How to set file size upload limit in php

藏色散人
Release: 2023-03-02 14:28:01
Original
2755 people have browsed it

How to set the file size in php: first find and open the "php.ini" configuration file; then set the switch that allows file uploading through HTTP; then find the "upload_max_filesize" item and modify the maximum value of the uploaded file size; Finally, set the maximum value that the form POST can receive to PHP.

How to set file size upload limit in php

php.ini method to modify the size limit of php upload files

Open php.ini, first find

file_uploads = on ;是否允许通过HTTP上传文件的开关。默认为ON即是开 upload_tmp_dir ;文件上传至服务器上存储临时文件的地方,如果没指定就会用系统默认的临时文件夹 upload_max_filesize = 8m ;望文生意,即允许上传文件大小的最大值。默认为2M post_max_size = 8m ;指通过表单POST给PHP的所能接收的最大值,包括表单里的所有值。默认为8M
Copy after login

Generally, after setting the above four parameters, uploading a file of <= 8M is not a problem, as long as the network is normal.

But if you want to upload a large file >8M, it will definitely work if you only set the above four items.

Further configure the following parameters

max_execution_time = 600 ;每个PHP页面运行的最大时间值(秒),默认30秒 max_input_time = 600 ;每个PHP页面接收数据所需的最大时间,默认60秒 memory_limit = 8m ;每个PHP页面所吃掉的最大内存,默认8M
Copy after login

After modifying the above parameters, you can upload large files under normal circumstances allowed by the network

max_execution_time = 600 max_input_time = 600 memory_limit = 32m file_uploads = on upload_tmp_dir = /tmp upload_max_filesize = 32m post_max_size = 32m
Copy after login

More related For knowledge, please visitPHP中文网!

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

Related labels:
php
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
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!