Using Discuz to implement PHP large file upload application example code _php Tutorial

Source: Internet
Author: User
Tags form post parse error
For those who do need to improve the upload conditions of the forum attachment, try to set the parameters mentioned above in php.ini to accommodate the need for large file uploads. At the same time, do not forget the forum in the background to do the attachment restrictions in place to set up.

There are 2 main forums where you can limit the size of attachment uploads, from high to Low:

    • Posts Related---Attachment type dimensions
    • User Groups---attachment related

At the same time, the following provides a configuration guide, the source of some success through the HTTP upload large attachments of friends, of course, due to the configuration of the server and the network situation is different, does not necessarily apply to your situation, there may be many places need to refer to the changes:

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 if not specified, the system default Temp folder is used
Upload_max_filesize 8m Wang Wen Business, that is, the maximum size allowed to upload files. Default is 2M
Post_max_size 8m Refers to the maximum value that can be received by a form post to PHP, including all values in the form. Default is 8M
Description
Generally, set up the above four parameters, in the network normal situation, upload <=8m files is not a problem
However, if you want to upload a large volume of >8m files, only set the above four items will certainly be able to pass. Unless your network really has a 100m/s upload speed, you still have to set the following parameters.
Max_execution_time 600 Maximum time value per php page (seconds), default 30 seconds
Max_input_time 600 Maximum time required for each PHP page to receive data, default 60 seconds
Memory_limit 8m Maximum memory consumed per PHP page, default 8M


After modifying the above parameters, it is possible to upload large volume files under normal conditions allowed by the network.

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

Is the reason for PHP 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 generally a problem with statements, such as ";", "'", "", and so on.

http://www.bkjia.com/PHPjc/319578.html www.bkjia.com true http://www.bkjia.com/PHPjc/319578.html techarticle for those who do need to improve the upload conditions of the forum attachment, try to set the parameters mentioned above in php.ini to accommodate the need for large file uploads. At the same time do not forget the forum after ...

  • 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.