Open PHP.ini, ctrl+f find the following items and modify them. The following 100M for example.
File_uploads = on; whether to allow the switch to upload files over HTTP. The default is on, which is open
Upload_tmp_dir files are uploaded to the server where temporary files are stored, and the system default temporary folder is used if unspecified
Upload_max_filesize = 100m business, that is, the maximum size of the upload file allowed. The default is 2M
Post_max_size = 100M refers to the maximum value that can be received by the form Post to PHP, including all the values in the form. The default is 8M
Generally, set the above four parameters, upload <=8m file is not a problem, in the normal network situation.
However, if you want to upload >8m files, only set up the above four will be able to do. Unless your network really has 100m/s upload high-speed, otherwise you have to care about the following parameters:
Max_execution_time = 600, maximum time for each PHP page to run (seconds), default 30 seconds
Max_input_time = 600: The maximum time required for each PHP page to receive data, default 60 seconds
Memory_limit = 128M, maximum memory consumed by each PHP page, default 8M
Here's an example:
Front desk:
Copy Code code as follows:
<form enctype= "Multipart/form-data" action= "upload.php" method= "POST" >
<!--max_file_size must precede the FILE input field-->
<input type= "hidden" name= "max_file_size" value= "100000000"/>
<!--name of INPUT element determines Name in $_files array-->
Send This file: <input name= "UserFile" type= "file"/>
<input type= "Submit" value= "Send File"/>
</form>
Background:
Copy Code code as follows:
<?php
$uploaddir = './video/';
foreach ($_files as $upfile)
{
$uploadfile = $uploaddir. $upfile [' name '];
if (Move_uploaded_file ($upfile [' Tmp_name '], $uploadfile))
echo "true";
Else
{
echo $_files[' userfile ' [' Error ']; See the comments below for details
echo "<br/>false";
}
}
?>
Note
Upload_err_ok
Value: 0; No error occurred, file upload succeeded.
Upload_err_ini_size
Value: 1; The uploaded file exceeds the value of the Upload_max_filesize option limit in php.ini.
Upload_err_form_size
Value: 2; The size of the upload file exceeds the value specified by the Max_file_size option in the HTML form.
Upload_err_partial
Value: 3; The file is only partially uploaded.
Upload_err_no_file
Value: 4; No files were uploaded.
After the above parameters are modified, the network allows the normal situation, you can upload large volume files.
Test upload 100M file successfully on this machine. If you have any questions, please leave a message!