What is the maximum size of a file that we can upload using PHP?
-
What type of files can be uploaded using PHP?
-
Answer:
2 GB. This is because PHP internally uses a signed 32-bit integer type for file size, and the largest possible value is therefore [math]2^{31} - 1[/math], which corresponds to 2 GB. See https://bugs.php.net/bug.php?id=44522&edit=1 for attempts to fix this.
Jelle Zijlstra at Quora Visit the source
Other answers
It is whatever is set as the upload_max_filesize and post_max_size in your php.ini file. If you want to know what they are currently set to you, can do: echo ini_get('upload_max_filesize'); and echo ini_get('post_max_size'); I am pretty sure that changing these with ini_set would have no effect, but you can modify the php.ini file or through Apache directives (i.e. in an .htaccess file). As noted by , it appears that there is an upper limit of 2GB. If you need more than that, you might want to google for flash unloaders that split file into parts before uploading. I don't know much about these, but a quick google suggests that they exist: https://www.google.com/search?q=flash+uploader+split+files&oq=flash+uploader+split&aqs=chrome.1.69i57j0.5035j0j9&sourceid=chrome&espv=210&es_sm=91&ie=UTF-8
Chaim Peck
The PHP website has a separate feature in the manual on http://php.net/manual/en/features.file-upload.php. This will give you a good idea about how you can upload files using the http://www.php.net/manual/en/features.file-upload.post-method.php and some of the http://www.php.net/manual/en/features.file-upload.common-pitfalls.php. As for the maximum size of a file, there are a few configuration options you should look at http://www.php.net/manual/en/ini.core.php#ini.upload-max-filesize. For the sake of ease, I am quoting some of the text from the common pitfalls page: The MAX_FILE_SIZE item cannot specify a file size greater than the file size that has been set in thehttp://www.php.net/manual/en/ini.core.php#ini.upload-max-filesize in the php.ini file. The default is 2 megabytes. If a memory limit is enabled, a larger http://www.php.net/manual/en/ini.core.php#ini.memory-limit may be needed. Make sure you set http://www.php.net/manual/en/ini.core.php#ini.memory-limit large enough. If http://www.php.net/manual/en/info.configuration.php#ini.max-execution-time is set too small, script execution may be exceeded by the value. Make sure you set max_execution_time large enough. Note: http://www.php.net/manual/en/info.configuration.php#ini.max-execution-time only affects the execution time of the script itself. Any time spent on activity that happens outside the execution of the script such as system calls using http://www.php.net/manual/en/function.system.php, the http://www.php.net/manual/en/function.sleep.php function, database queries, time taken by the file upload process, etc. is not included when determining the maximum time that the script has been running. Warning http://www.php.net/manual/en/info.configuration.php#ini.max-input-time sets the maximum time, in seconds, the script is allowed to receive input; this includes file uploads. For large or multiple files, or users on slower connections, the default of 60 seconds may be exceeded. If http://www.php.net/manual/en/ini.core.php#ini.post-max-size is set too small, large files cannot be uploaded. Make sure you set post_max_size large enough. Since PHP 5.2.12, the http://www.php.net/manual/en/ini.core.php#ini.max-file-uploads configuration setting controls the maximum number of files that can uploaded in one request. If more files are uploaded than the limit, then http://www.php.net/manual/en/reserved.variables.files.php will stop processing files once the limit is reached. For example, if http://www.php.net/manual/en/ini.core.php#ini.max-file-uploads is set to 10, then http://www.php.net/manual/en/reserved.variables.files.php will never contain more than 10 items. Most of the text given above is self-explanatory. If you have any doubts, do comment.
Aniket Pant
if you are using your localhost and apache server, then default is 2MB max per file, number of files that can be uploaded is 20(per session), and total size of all the files that can be uploaded is 8MB. This can be altered as well.
Arya Singh
Related Q & A:
- What is the maximum speed of a boeing 747? (cruising speed?Best solution by Yahoo! Answers
- What is the engine size of a Toyota Corolla?Best solution by Yahoo! Answers
- What is the maximum size of a file we can send from Yahoo?Best solution by Yahoo! Answers
- What is the exact size of a Yugioh card?Best solution by Yahoo! Answers
- What is the average size of a business card?Best solution by tinyprints.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.