Home >Backend Development >PHP Tutorial >Settings required when uploading large files in PHP:_PHP tutorial
Needless to say, you still have to look for the PHP configuration file php.ini:)
Open php.ini, first find the
;;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;
area, the following parameters that affect file uploads:
file_uploads = on ; Whether to allow file uploads via HTTP switch. The default is ON, which means open
upload_tmp_dir; Files are uploaded to the place where temporary files are stored on the server. If not specified, the system default temporary folder will be used
upload_max_filesize = 8m; For business purposes, the file size is allowed to be uploaded the maximum value. The default is 2M
in
;;;;;;;;;;;;;;;;;;
; Data Handling ;
;;;;;;;;;;; ;;;;;;;
area, there is another item:
post_max_size = 8m; refers to the maximum value that can be received through POST to PHP through the form, including all values in the form. The default is 8M
Generally, after setting the above four parameters, uploading files of
But if you want to upload a large file >8M, it will definitely work if you only set the above four items. Unless your network really has an upload speed of 100M/S, you still have to care about the following parameters:
;;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;
max_execution_time = 600 ;The maximum time value (seconds) for each PHP page to run, the default is 30 seconds
max_input_time = 600 ;The maximum time required for each PHP page to receive data, the default is 60 seconds
memory_limit = 8m ;The maximum memory consumed by each PHP page, the default is 8M
After modifying the above parameters, Under normal circumstances allowed by the network, large files can be uploaded.
Okay, you can give it a try now after setting it up. Click on a 200M file to upload it
While you are listening to music, thinking about sex, or coming back from going to the toilet, the program will tell you that the upload is successful~
Test uploading a 200M file on this machine was successful.
Luck~~