Php cannot upload large files

Source: Internet
Author: User

  1. <Form enctype = "multipart/form-data" action = "add_file.php" method = "post">
  2. <Fieldset> <legend> Fill out the form to upload a file: </legend>
  3. <? Php // Create the inputs.
  4. For ($ I = 0; $ I <$ counter; $ I ++ ){
  5. Echo '<B> File: </B> <input type = "file" name = "upload'. $ I. '"/>
  6. <B> Description: </B> <textarea name = "description'. $ I. '" cols = "40" rows = "5"> </textarea>
  7. ';
  8. }
  9. ?>
  10. </Fieldset>
  11. <Input type = "hidden" name = "submitted" value = "TRUE"/>
  12. [Align = center] <input type = "submit" name = "submit" value = "Submit"/> [/align]
  13. </Form>
When a File with a slightly larger size is found during actual execution, the File couldn't be moved is displayed.
The file name is displayed in the database, but the size is not displayed.
When a file larger than 8 Mb is uploaded, the page does not respond.

Several articles found on the Internet:
Solve the Problem of uploading large files in PHP
Php settings allow large file uploads
Upload large files using apache + php
Php. ini settings when uploading large files

All the above articles indicate that php File Upload is affected by the following settings of php. ini:
  1. Post_max_size
  2. Upload_max_filesize
  3. Max_execution_time
  4. Memory_limit
Find/etc/php5/apache2/, find php. ini, search for post_max_size, and change its default value to 125 M;
Search for upload_max_filesize, change its default value to 125 MB, and save the settings.
Enter apache2ctl-k restart on the terminal to restart apache. The problem is solved successfully.

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.