Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the maximum upload file size

Tags:

php

I have a website hosted on a PC I have no access to. I have an upload form allowing people to upload mp3 files up to 30MB big. My server side script is done in PHP.

Every time I try and upload a file, I receive an error claiming that the file exceeds the maximum size allowed, so I need to increase the size. My research on the web suggested changing the .htaccess file which I do not have access to, so that won't work. Others suggested that I should add a custom php.ini file to my root which did not work. Any other suggestions?

like image 908
Yo Momma Avatar asked Feb 02 '10 14:02

Yo Momma


People also ask

What is the maximum size of file uploading?

The default values for PHP will restrict you to a maximum 2 MB upload file size.

How can I increase maximum upload file size in cPanel?

Open the MultiPHP INI editor and select a location from the dropdown. Scroll to the entry for upload_max_filesize and edit the associated value. Ensure that the value for post_max_size is larger than upload_max_filesize, and click apply at the bottom of the page.


1 Answers

You need to set the value of upload_max_filesize and post_max_size in your php.ini :

; Maximum allowed size for uploaded files. upload_max_filesize = 40M  ; Must be greater than or equal to upload_max_filesize post_max_size = 40M 

After modifying php.ini file(s), you need to restart your HTTP server to use the new configuration.

If you can't change your php.ini, you're out of luck. You cannot change these values at run-time; uploads of file larger than the value specified in php.ini will have failed by the time execution reaches your call to ini_set.

See the Description of core php.ini directives.

like image 126
meagar Avatar answered Sep 28 '22 08:09

meagar