Using Discuz to realize php large file upload application instance code _php skill

Source: Internet
Author: User
Tags form post parse error

For those who really need to improve the forum attachment upload criteria, you can try to set the parameters mentioned above in php.ini to fit the needs of large file uploads. At the same time do not forget the forum in the background to do the attachment restrictions to set the place.

The forum mainly has 2 places to be possible the attachment uploads the size to limit, the level from high to low is:

    • Post Related---Attachment type size
    • User Group---attachment related

At the same time, the following provides a configuration guide, the source of some successful HTTP upload large attachments of friends, of course, because everyone's server configuration and network situation is different, and does not necessarily apply to your situation, there may be many places need to modify the reference:

Open PHP.ini,


Parameters Set up Description
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 8m Wang Wen Business, that is, allow the maximum size of uploaded files. The default is 2M
Post_max_size 8m 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
Description
Generally, set the above four parameters, in the case of normal network, upload <=8m file is not a problem
However, if you want to upload >8m files, only set up the above four will be able to do. Unless your network is really 100m/s upload high-speed, you have to continue to set 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 8m The maximum memory consumed by each PHP page, default 8M


After the above parameters are modified, the network allows the normal situation, you can upload large volume files

Forum File Upload common error type (constantly summarizing ...) )
    • warning:unable to open ' \\php2 ' for reading:invalid argument into e:\user\web\larksoft.net\upload\upfile.php on line 10

Is the reason for PHP's upload_tmp_dir, the specified directory must be readable and writable

    • Parse error:parse Error in C:\Program Files\apache group\apache\htdocs\mdweb\ftpfile\upload.php on line 14

Parse error is usually the problem of the sentence, such as ";", "'", "" etc.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.