Get started with 33% off your first certification using code: 33OFFNEW

How to upload large files in WordPress admin area

2 min read
Published on 19th June 2023
How to upload large files in WordPress admin area

When running a WordPress website, there may be instances when you need to upload large files through the admin area. However, you might face issues due to restrictions on file size by default configurations in WordPress and your server. This guide provides solutions to these limitations and details how to upload large files in the WordPress admin area.

Increasing the Upload Limit

There are a few places where file upload sizes can be restricted: your php.ini file, the functions.php file of your theme, or .htaccess file.

php.ini Method

If you have access to your php.ini file, you can increase the limits directly. Here's what you need to modify:

upload_max_filesize = 64M
post_max_size = 64M
memory_limit = 256M

These settings increase the maximum file upload size to 64MB and the memory limit to 256MB.

functions.php Method

If you don't have access to php.ini, you can add the following code to your theme’s functions.php file:

@ini_set('upload_max_size' , '64M');
@ini_set('post_max_size', '64M');
@ini_set('memory_limit', '256M');

These settings achieve the same goal as the php.ini method but within the WordPress environment.

Remember, it's important to keep your functions.php clean and well organized. We have a guide on how to keep your WordPress code organized.

.htaccess Method

Another way to achieve the same effect is by modifying the .htaccess file in your WordPress site’s root directory:

php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value memory_limit 256M

Uploading Large Files

Once you've increased the upload limit, you can add large files through the WordPress admin area in the normal way:

  1. Go to Media > Add New in your WordPress dashboard.
  2. Click 'Select Files' to open the file dialog box.
  3. Select the large file to upload.

The file will upload according to the new size limit you've set.

Remember to consider the implications of allowing large file uploads, such as the potential impact on storage and bandwidth. As always, adjust the file size limits according to the specific needs of your WordPress website.

The methods described in this article should help you handle large file uploads in the WordPress admin area.

If you're still having issues with your uploads then it will be worth opening a ticket with your hosting provider, who may have extra limitations in place. One additional point to consider is whether you're using a WAF (Web Application Firewall), such as Cloudflare, as these tools can also implement their own limit.