Increase max upload file size in WordPress Multisite network?

11.5k views Asked by At

I'm trying to increase the max file size for a WordPress multisite install (currently 1MB). I've tried a number of things to no avail. The things I've tried:

Adding these to my hosts php.ini file:

memory_limit = 300M
post_max_size = 32M
upload_max_filesize = 32M

Adding these to the functions.php file in the theme:

@ini_set('upload_max_size' , '32M');
@ini_set('post_max_size', '32M');
@ini_set('max_execution_time', '300');

Adding these to the .htaccess file:

php_value upload_max_filesize 32M
php_value post_max_size 32M

I even tried checking the wp-includes/default-constants.php.

Interestingly, I have another WordPress install (not multisite) on the same server that seems to work perfectly (max upload there is 32MB). Any ideas what to try next?

Thank you.

7

There are 7 answers

5
Phil On BEST ANSWER

Figured it out. In all my infinite wisdom, I completely missed the "Max upload file size" setting in Network Admin > Settings > Network Settings. It's right near the bottom of the page.

0
Jay Lepore On

Phil is correct: Network Admin (My Sites > Network Admin) then go to Settings > Network Settings. It's near the bottom under Upload Settings, called Max upload file size.

However, also note you have to go with a flat 1000kb or 2000kb etc.

I put 1500kb in there and it still limited me to 1 MB but when I increased it to 2000kb it allowed up to 2 MB

6
Eek On

Try creating a php.ini file with

memory_limit = 32M
upload_max_filesize = 32M
post_max_size = 32M
file_uploads = On

and save it in the wp-admin/ folder :)

If this doesn't work, try adding the following to wp-config.php

define('WP_MEMORY_LIMIT', '64M');
ini_set('post_max_size', '32M');
ini_set('upload_max_filesize', '32M');
0
Beatscissors On

@Allpnay posted the solution, just paste on functions.php:

add_filter( 'upload_size_limit', 'PBP_increase_upload' );
function PBP_increase_upload( $bytes )
{
  return 1048576; // 1 megabyte
}

In my case want 8mb so change for return 8000000; // 8 megabyte

0
Jesse Nickles On

If anyone else is looking for a programmatic solution, this is what we are doing in SlickStack on brand new installations to change this setting value:

ss_mysql --execute="UPDATE ${DB_NAME}.${DB_PREFIX}sitemeta SET option_value='16000' WHERE option_name='fileupload_maxk'";

Note that adjusting php.ini settings will have no effect because WordPress Multisite has it's own special setting for this in the database.

0
allpnay On

Try this, i use this filter for my Multisite and this work great

add_filter( 'upload_size_limit', 'PBP_increase_upload' );
function PBP_increase_upload( $bytes )
{
return 1048576; // 1 megabyte
}
0
Brandon Orndorff On

Create a file called .user.ini in your Wordpress root folder and add the following to it:

upload_max_filesize = 64M
post_max_size = 64M
memory_limit = 64M
max_execution_time = 300

This fixed it for me after all else failed.