For those who really need to improve the conditions for uploading forum attachments, you can try to set the parameters mentioned above in php.ini to adapt to the needs of large file uploads. At the same time, don’t forget to set the attachment restrictions in the background of the forum.
There are two main places in the forum where you can limit the size of attachment uploads. The levels from high to low are:
At the same time, here is a configuration guide provided by some friends who have successfully uploaded large attachments through http. Of course, due to different server configurations and network conditions, it may not apply to you. In this case, many places may need to be modified by reference:
Open php.ini,
Parameters | Settings | Description |
file_uploads | on | Switch whether to allow file uploading through HTTP. The default is ON, that is, open |
upload_tmp_dir | -- | The file is 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 | Wangwen business, that is, the maximum size of the file allowed to be uploaded. The default is 2M |
post_max_size | 8m | refers to the maximum value that can be received through form POST to PHP, including all values in the form. The default is 8M |
Explanation | ||
Generally, after setting the above four parameters, when the network is normal, uploading files of | ||
But if you want to upload> For a large file of 8M, it will definitely work if you only set the above four items. Unless your network really has a 100M/S upload speed, you have to continue setting the following parameters. | ||
max_execution_time | 600 | Maximum time value (seconds) for each PHP page to run, default 30 seconds |
max_input_time | 600 | Maximum time required for each PHP page to receive data, default 60 Seconds |
memory_limit | 8m | The maximum memory consumed by each PHP page, default 8M |
After modifying the above parameters, you can upload large files under normal circumstances allowed by the network
is for php The reason for upload_tmp_dir, the specified directory must be readable and writable
Parse error is generally a statement problem, such as ";", Matching problems with "'", ")", etc.
The above has introduced the example code of using discuz to implement PHP large file upload application, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.