8

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.

Phil
  • 1,849
  • 4
  • 24
  • 38

7 Answers7

23

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.

Phil
  • 1,849
  • 4
  • 24
  • 38
  • @Ramie It's in the 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. – Phil Jul 03 '14 at 15:03
  • can't see it, does it appear in the self-hosted wordpress instance ? – Rami Sarieddine Jul 04 '14 at 07:36
  • Yup. It's there for me. Are you sure you're in the network admin, not just the site admin? – Phil Jul 04 '14 at 15:52
  • i am on site admin. haven't been to the network admin before. anyways i fixed the problem by uploading a .user.ini file – Rami Sarieddine Jul 05 '14 at 11:50
  • 4
    I've tried all above steps and also tried increasing value in Network admin. Still I'm getting 2MB on media upload screen – Siddharth Jain Apr 16 '16 at 04:25
3

@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

Seth McClaine
  • 9,142
  • 6
  • 38
  • 64
2

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

Peter O.
  • 32,158
  • 14
  • 82
  • 96
Jay Lepore
  • 85
  • 1
  • 7
2

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
}
allpnay
  • 539
  • 6
  • 19
1

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.

Brandon Orndorff
  • 257
  • 6
  • 18
0

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');
Eek
  • 1,740
  • 1
  • 15
  • 24
  • Still no luck. Max upload size is still 1MB. – Phil Dec 09 '13 at 16:07
  • I have edited my answer, can you try adding those lines in wp-config.php. Also, do you have any `php.ini` files in your wordpress folders / ini_set's somewhere else? – Eek Dec 09 '13 at 16:20
  • Sadly, still nothing. I don't have any php.ini files anywhere in the WordPress install. – Phil Dec 09 '13 at 16:29
  • Create php.ini inside wp-admin folder and make the changes . It will work for sure. – Lakin Mohapatra Apr 20 '18 at 08:30
  • i tried this solutions and none of them worked for me. Still shows 2MB upload limit. – Ozan BAYRAM Mar 29 '22 at 14:05
  • If none of the above work, then you will need to increase it in the main php.ini config. You can make a php file and write `phpinfo();` in it, then access that file and you should see all the config information. What you're looking for is under "Loaded Configuration File", you will need to edit that file. If that file also has a maximum upload file size increase, but you don't see it, then you need to edit your webserver config, aka nginx config, or apache config or whatever webserver you have. – Eek Dec 06 '22 at 15:10
0

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.

Jesse Nickles
  • 1,435
  • 1
  • 17
  • 25