By default, WordPress sets the maximum upload file size to 32MB (It could be different in some hosts) but Sometimes you need to upload a large file to your blog and here this limit creates problem . A fairly common error you will see when trying to upload a file larger than your settings is: Fatal error: Allowed memory size of 33554432 bytes exhausted followed by a server directory path.
In order to fix this “problem” you’ll need to increase the maximum upload size which you can try by using one of the following three methods.
SOLUTION 1: EDITING OR CREATING PHP.INI FILE
php.ini is php configuration setting file normally located in your root directory. In most cases if you are on a shared host, you will not see a php.ini file in your directory. In that case you need to create it. Create a blank text file and save it with name “php” and extension “.ini” . Now open it with any text editor and add the following code to it :
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
After adding code save it and upload it in your blog’s admin directory(/wp-admin) . This method is reported to work for many users. Remember if 64 doesn’t work. Try 10MB (sometimes that work).
SOLUTION 2: EDITING YOUR THEME FUNCTION FILE
Many people says that best method is to add some code to your theme’s functions.php file to increase the max upload size. Add the following lines (you can edit where it says 64M to whatever you want the max upload size to be) in the functions.php file within the php tags:
|@ini_set( ‘upload_max_size’ , ’64M’ );|
@ini_set( ‘post_max_size’, ’64M’);
@ini_set( ‘max_execution_time’, ‘300’ );
SOLUTION 3: .HTACCESS TRICK
Some people Found this method by modifying .htaccess file in the root directory . You can increase max file upload size in WordPress is by adding the following code to their .htaccess file
|php_value upload_max_filesize 64M|
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300
If you are on a shared hosting environment,then these techniques may not work. In that case you need to contact your web hosting provider to increase file upload limit. Some hosts completely denies this type requests ,so I suggest you to use recommended Web hosts.
Tell us “Which method you used and which one worked for you ?” Share your experience in comments.