Some questions about PHP's next pass

Source: Internet
Author: User
Questions about uploading to PHP
Move_uploaded_file function
Uploading files

Now the requirement is that you can upload any file
However, the total file size cannot exceed 5M

What should be done??


------Solution--------------------
The limit of upload file size is generally changed in php.ini and httpd.conf configuration files, such as php.ini.
Upload_max_filesize = 8M
Post_max_size = 10M
Memory_limit = 20M
This type of Setup, in Httpd.conf, has
Limitrequestbody 10485760
This type of Setup

However, in the PHP file you can directly determine the size of the upload file, such as judging $_files["file" ["size"] if greater than 5M will not move_uploaded_file move.
------Solution--------------------
Upload the corresponding file upload information (according to the user, the total size of the upload file with database or file record or the user uploads each file size)

Is it not possible to make a corresponding judgment afterwards?
------Solution--------------------
Confirm in PHP.ini
session.upload_progress.enabled = On
Session.upload_progress.cleanup = Off

You can be in
$_session["Upload_progress_laruence" ["Content_length"]
The total size of the uploaded file in the

I don't think you would exclude PHP 5.4, would you?

------Solution--------------------
You should be a single user upload total size bar, recorded in the database is better, each user add an upload total size field, each comparison and update.
------Solution--------------------
References:
reference: Upload and record the corresponding file upload information (according to the user, the total size of the uploaded file with database or file record or the user uploads each file size)

Is it not possible to make a corresponding judgment afterwards?

That makes sense, but it seems that my demand may be no solution, mainly upload attachments to send mail, once so much,

For example, for the first time, you could pass 19M.
The second time can still be a total of 19M
Even in a database, it's not good to judge
...

That is, each email attachment can not be greater than 5M, it is good to judge Ah, the total size of the database record upload, can not be greater than 5M, each time after the file is sent empty to 0 recalculation.
------Solution--------------------
Reference:
Forget, PHP version of their own can not change ~ Customer's server ~

That's not going to be an addition, is 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.