How to Change the WordPress Upload Limit
Five ways to raise WordPress's media upload limit. Pick whichever method works for your hosting environment.
Check the current upload limit
The current limit appears on the WordPress admin's Media → Add New screen as "Maximum upload size: XX MB". You can also see PHP settings in Site Health → Info. WordPress defaults to 2–10 MB depending on your PHP configuration.
The effective upload limit is the smallest of these three settings:
upload_max_filesize— maximum size per uploaded filepost_max_size— maximum size of an entire POST request (must be larger than upload_max_filesize)memory_limit— maximum memory PHP can use
Method 1: Edit wp-config.php
The simplest approach. Add the following line to wp-config.php in your WordPress root.
@ini_set('upload_max_filesize', '64M');
This won't work if your server disables ini_set. In that case, try the other methods. To raise WordPress's memory limit specifically, you can also use:
define('WP_MEMORY_LIMIT', '256M');
This raises WordPress's memory limit but doesn't directly change the upload limit. Combine it with one of the methods below.
Method 2: Edit .htaccess (Apache)
If you're on Apache with mod_php, add this to .htaccess in your WordPress root.
php_value upload_max_filesize 64M
php_value post_max_size 128M
php_value memory_limit 256M
php_value max_execution_time 300
php_value max_input_time 300
Note: CGI PHP and FastCGI environments (common on shared hosts) cannot change PHP settings via .htaccess. If you get a 500 error, remove the lines you added.
Method 3: Edit php.ini / .user.ini
Editing the PHP config file is the most reliable approach but requires server access.
php.ini
upload_max_filesize = 64M
post_max_size = 128M
memory_limit = 256M
max_execution_time = 300
max_input_time = 300
.user.ini (for shared hosts)
If you can't edit php.ini directly, create a .user.ini file in your WordPress root with the same content. Changes may take a few minutes to a few hours to take effect.
upload_max_filesize = 64M
post_max_size = 128M
memory_limit = 256M
Method 4: Add a filter to functions.php
Add hooks to your theme's functions.php. This works when you can't change PHP settings directly, but it cannot exceed the server's PHP limits.
@ini_set('upload_max_filesize', '64M');
@ini_set('post_max_size', '128M');
@ini_set('memory_limit', '256M');
@ini_set('max_execution_time', '300');
@ini_set('max_input_time', '300');
Or use a WordPress filter:
add_filter('upload_size_limit', function($size) {
return 64 * 1024 * 1024; // 64MB
});
Note: This only changes WordPress's limit; the underlying PHP upload_max_filesize still wins if it's smaller.
Method 5: Use your hosting control panel
Most managed WordPress hosts let you change PHP settings from their control panel. This is the safest and most reliable approach. Look for a "PHP settings" or "php.ini" section, then change upload_max_filesize and post_max_size.
Testing the new limit
After changing the settings, test by uploading a large file. DevLab's threshold test files let you run precise boundary-value tests against your new limit.
| Test case | What to verify |
|---|---|
| File just under the limit (e.g. 63 MB if limit is 64 MB) | Uploads successfully |
| File exactly at the limit (e.g. 64 MB) | Confirm whether it's accepted |
| File just over the limit (e.g. 65 MB) | Returns a clear error message |
Troubleshooting
- Settings don't apply: You may need to restart Apache/Nginx or the PHP-FPM process.
- 500 error: Check your
.htaccessfor typos or unsupported directives. - 413 error: On Nginx, check
client_max_body_sizeinnginx.conf. - Timeouts: Large uploads also need higher
max_execution_timeandmax_input_time.