Questions about PHP Upload

Source: Internet
Author: User
About PHP Upload move_uploaded_file function
Upload files

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

What should we do ??


Reply to discussion (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.

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

But in PHP ......

Total file size ~~ Not single. it seems wrong.

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?

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?

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?

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.

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 ......
You cannot change the php version ~ Customer's server ~

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.

Reference the response from ohmygirl on the third floor: upload the corresponding file information at the same time (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.

The author's location is incorrect. it is not 5 MB. The total size of attachments in one email cannot exceed 20 MB ~

You cannot change the php version ~ Customer's server ~
So it won't be able to do addition, will it?

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.