Home Backend Development PHP Tutorial PHP upload file size limit problem post_max_size impact on size and solution std size t header file size header file java file siz

PHP upload file size limit problem post_max_size impact on size and solution std size t header file size header file java file siz

Jul 29, 2016 am 08:52 AM
size upload files

Today I discovered a problem when operating PHP upload. That is, when the file size uploaded by PHP script exceeds the limit of post_max_size in php.ini, the page will not give a reminder and the file will also fail to upload. This problem seems to be An alternative, I would like to share it with you today.

php.ini configuration parameters that affect the size of php upload files are:
Configuration items Possible values ​​Function description
file_uploads                                                                                                                                                                                                                                                                     Amount to prevent runaway scripts from monopolizing server memory
           
upload_max_filesize                                                                                                                            8M Limits the maximum amount of information that can be accepted through the POST method And the error in the corresponding $_FILES The corresponding error messages are:

Errors generated during file upload
                                                                                                                                                                                                                          2: Indicates that the uploaded file size exceeds the value specified by the MAX_FILE_SIZE option in the HTML form. 3: Indicates that the file is only partially uploaded.                                                                                                                                                                                                                                            ​Make a judgment, but there is no corresponding judgment for

post_max_size. At this time, the page is actually in a crashed state, and the page will not give any prompts.



For this problem, the current method that comes to mind is to obtain the post_max_size configuration value through the ini_get() function, and then send it to the front desk for verification. Another method is to directly verify in the background and first use ini_get() to obtain the value of post_max_size, and then compare it with the file to be uploaded. However, this requires first obtaining the size of the file through ajax.

qq:411200871 (AVIA Technology), if you have a good way to communicate with each other.

The above introduces the problem of PHP upload file size limit. The impact of post_max_size on the size and its solution, including the content of uploaded files and size. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Use java's File.length() function to get the size of the file Use java's File.length() function to get the size of the file Jul 24, 2023 am 08:36 AM

Use Java's File.length() function to get the size of a file. File size is a very common requirement when dealing with file operations. Java provides a very convenient way to get the size of a file, that is, using the length() method of the File class. . This article will introduce how to use this method to get the size of a file and give corresponding code examples. First, we need to create a File object to represent the file we want to get the size of. Here is how to create a File object: Filef

How to upload files to 123 cloud disk How to upload files to 123 cloud disk Feb 24, 2024 pm 05:30 PM

How to upload files to 123 Cloud Disk? You can upload files to 123 Cloud Disk for storage, but most friends don’t know how to upload files to 123 Cloud Disk. Next is the picture and text of how to upload files to 123 Cloud Disk brought by the editor for players. Tutorial, interested users come and take a look! How to upload files on 123 Cloud Disk 1. First open 123 Cloud Disk and enter the main page, register or log in to the account; 2. Then enter the page as shown below, click the [Upload] button guided by the arrow; 3. Then the bottom will expand In the function bar window, click the [Select File] function; 4. Finally, select the file to be uploaded and wait patiently for the upload to complete.

How to upload files to Nut Cloud How to upload files to Nut Cloud Feb 27, 2024 pm 03:58 PM

Nut Cloud is an efficient file management tool dedicated to providing users with intelligent file saving and synchronization services. It has powerful data synchronization and backup functions to ensure that users' data is safe. A series of functions of Nut Cloud are designed to meet the needs of users in different scenarios and provide an excellent user experience. So how to upload files in the Nut Cloud app? This tutorial guide will give you a detailed introduction to the steps. I hope it can help everyone in need. How to upload files to Nut Cloud? 1. On the My Files page, click on My Nut Cloud to open it. 2. On the opened page, click the plus icon in the lower right corner. 3. In the options that pop up at the bottom, click Upload from SD card. 4. In the opened mobile phone storage, select the file.

Use the size() method of the TreeSet class to get the number of elements in the tree collection Use the size() method of the TreeSet class to get the number of elements in the tree collection Jul 24, 2023 am 11:05 AM

Title: Use the size() method of the TreeSet class to obtain the number of elements in the tree collection. Introduction TreeSet is an ordered collection in the Java collection framework. It implements the SortedSet interface and uses the red-black tree data structure to implement it. TreeSet can be sorted according to the natural order of elements, or by using a Comparator custom comparator. This article will introduce how to use the size() method of the TreeSet class to obtain the number of elements in the tree collection and provide

How to handle upload file errors in PHP? How to handle upload file errors in PHP? Dec 02, 2023 am 11:09 AM

How to handle upload file errors in PHP? In the actual web development process, file upload is a common functional requirement. However, when processing file uploads, various errors may occur, such as files exceeding size limits, file types not allowed, etc. This article will introduce how to handle errors in uploading files in PHP and provide specific code examples. File upload errors are usually divided into two broad categories: client-side errors and server-side errors. Client errors refer to problems that occur when users upload files, such as the uploaded file is too large, the file type is

Detailed tutorial on performance optimization of MySQL database on Linux system. Detailed tutorial on performance optimization of MySQL database on Linux system. Feb 19, 2024 pm 05:51 PM

The following is a detailed tutorial on MySQL database performance optimization under Linux systems: Optimize configuration file: Open the MySQL configuration file (usually my.cnf or my.ini). Adjust the following parameters to optimize performance: key_buffer_size: Adjust the index cache size to fit the size of your data. innodb_buffer_pool_size: Adjust the InnoDB buffer pool size to suit your data size. innodb_log_file_size: Adjust the InnoDB log file size to fit your write load. query_cache_size: Enable and resize the query cache. max_connection

PHP form processing example uploading files PHP form processing example uploading files Jun 20, 2023 pm 05:37 PM

PHP form processing example: uploading files In website development, we often need to provide users with the function of uploading files, such as avatars, pictures, documents, etc. As a back-end language, PHP can easily implement the file upload function. In this article, we will implement the file upload function based on PHP. 1. Prerequisite knowledge Before starting, there are some basic PHP knowledge that must be mastered: Collecting form data: PHP can obtain form data through global variables such as $_POST and $_GET. File upload: PH

How does PHP handle uploading and processing of multimedia files? How does PHP handle uploading and processing of multimedia files? Jun 30, 2023 am 11:25 AM

How does PHP handle multimedia file uploading and processing? With the development of the Internet, the use of multimedia files is becoming more and more common. Whether it is pictures, audio or video files, they are all things we often need to deal with when developing websites. This article will introduce how PHP handles the uploading and processing of multimedia files. Multimedia file upload PHP provides some functions to handle the upload of multimedia files. Commonly used functions include: move_uploaded_file(): Move the uploaded file to the specified directory. This function can be used

See all articles