Questions about PHP download

Source: Internet
Author: User
Tags php download
About PHP Upload move_uploaded_file & nbsp; the function now requires that you can upload any file, but the total file size cannot exceed 5 MB. How can this problem be solved ??, The size limit of the file to be uploaded is generally found in the php. ini and httpd. conf configuration files.
Move_uploaded_file Function
Upload files

You can upload any file.
However, the total file size cannot exceed 5 MB.

What should we do ??
------ Solution --------------------
The size limit of uploaded files is generally modified in the php. ini and httpd. conf configuration files. For example, php. ini contains
Upload_max_filesize = 8 M
Post_max_size = 10 M
Memory_limit = 20 M
These settings are available in httpd. conf.
LimitRequestBody 10485760
Such settings

However, you can directly determine the size of the uploaded file in the PHP file. For example, you can judge $ _ FILES ["file"] ["size"] If the size is greater than 5 MB, move_uploaded_file will not be moved.
------ Solution --------------------
Upload the corresponding file upload information at the same time (according to the user, use the database or file to record the total size of the uploaded file or the size of each File Uploaded by the user)

Can I make the corresponding judgment afterwards?
------ Solution --------------------
Confirm in php. ini
Session. upload_progress.enabled = on
Session. upload_progress.cleanup = off

You can
$ _ SESSION ["upload_progress_laruence"] ["content_length"]
To obtain the total size of the uploaded file.

I don't think you will reject php 5.4, will it?

------ Solution --------------------
You should be the total upload size of a single user. The records in the database are relatively good. Each user adds an upload total size field for each comparison and update.
------ Solution --------------------
Reference:
Reference: records the upload information of the corresponding file at the same time of upload (the total size of the uploaded file or the size of each File Uploaded by the user is recorded in the database or file)

Can I make the corresponding judgment afterwards?

It makes sense, but it seems that I have no solution to this requirement. I mainly upload attachments to send emails,

For example, you can upload a total of 19 MB for the first time.
For the second time, you can still upload a total of 19 MB
It is hard to judge whether it is stored in the database.
......

That is to say, the attachment size of each sent email cannot exceed 5 MB. It is very good to judge. The total size of the uploaded database records cannot exceed 5 MB. After each file is sent, it is cleared to 0 and recalculated.
------ Solution --------------------
Reference:
You cannot change the php version ~ Customer's server ~

So it won't be able to do addition, will it?
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.