# Set the Maximum Upload Size for the Whole Network

> Overrides the network's "Max upload file size" setting from code, so every site gets the same per-file limit regardless of what is stored in the database.

- Type: PHP
- Runs: Run everywhere
- Category: [Multisite](https://wpide.com/library/category/multisite/)
- Tags: uploads, file-size, limits
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/ms-network-max-upload-size/

## Code

```php
if ( ! is_multisite() ) {
    return;
}

$wpide_max_kb = 20480; // 20 MB.

add_filter( 'site_option_fileupload_maxk', function () use ( $wpide_max_kb ) {
    return (int) $wpide_max_kb;
} );
```

## Notes

Value in kilobytes. PHP's upload_max_filesize and post_max_size still cap the real limit.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Set the Maximum Upload Size for the Whole Network" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
