The Easiest Way to Increase Your Maximum File Upload Size in WordPress

by | Jan 24, 2025 | Tutorials

Tl;DR: Big File Uploads is the easiest way to increase your maximum file upload size!

Understanding the Maximum File Upload Size

The maximum file upload size in WordPress is set by the hosting provider and can be checked in the Media Library or Site Health Info panel. The default maximum upload size in WordPress is typically between 4 MB to 128 MB, which can be adjusted by modifying the default PHP settings in the php.ini file. The maximum upload size limit is in place to prevent server timeouts and security issues. Additionally, managing the max upload file size is crucial for better media handling in WordPress.

Understanding File Type Restrictions

In addition to the maximum file upload size, WordPress also has file type restrictions that can affect what types of files can be uploaded to the media library. These restrictions are in place to prevent malicious files from being uploaded and to ensure that only safe and compatible files are allowed.

By default, WordPress allows the following file types to be uploaded:

  • Images: .jpg, .jpeg, .png, .gif, .bmp
  • Audio: .mp3, .wav, .ogg
  • Video: .mp4, .mov, .wmv
  • Documents: .pdf, .doc, .docx, .xls, .xlsx, .ppt, .pptx
  • Archives: .zip, .rar, .7z

However, some file types are restricted by default, including:

  • Executable files: .exe, .com, .bat
  • Script files: .php, .js, .py
  • System files: .ini, .conf, .cfg

If you need to upload a file type that is not allowed by default, you can modify the file type restrictions by adding custom code to your WordPress site’s functions.php file or by using a plugin that allows you to upload restricted file types.

It’s important to note that allowing certain file types to be uploaded can pose a security risk to your site, so it’s important to carefully consider what file types you allow and to ensure that your site is properly secured.

In addition to file type restrictions, you can also restrict the maximum file upload size for specific file types. For example, you may want to allow larger image files to be uploaded, but restrict the size of video files. You can do this by adding custom code to your WordPress site’s functions.php file or by using a plugin that allows you to set file type-specific upload limits.

Overall, understanding file type restrictions is an important part of managing your WordPress site’s media library and ensuring that your site is secure and functional.

Checking the Current Maximum Upload Size

The current maximum file upload limit in WordPress can be checked in the Media Library after you select the button “Add New Media File”.

Or, it can be checked by going to Tools Site Health > Info > Upload max filesize

The maximum upload size limit is set by the hosting provider and can be modified by the host, through cPanel dashboard (if using) or through .htaccess, wp-config.php (not recommended), or our favorite method, using a plugin.

Why Increase the Maximum File Upload Size?

As pictures & videos become bigger, the default file upload size set by many hosts are not enough. Most hosts set it to a very low limit of 2MB, which is about a quarter of the size of most iPhone photos, let alone professional photography or images.

Additionally, a low file upload size in WordPress can also prohibit you from uploading plugin zip files & theme files, as the upload limit applies to those areas too. This means you will not be able to add any plugins to your site until it is increased!

  1. Small Plugins (Basic Functionality)
    1. Size Range: 50 KB – 1 MB
    2. Examples: Plugins for redirects, shortcodes, or small performance tweaks.
    3. Characteristics: These are lightweight and minimal, with streamlined codebases. They don’t include large assets like images or JavaScript libraries, making them ideal for simple tasks without adding much overhead to your site.
  2. Medium-Sized Plugins (Moderate Functionality)
    1. Size Range: 1 MB – 5 MB
    2. Examples: Tools like Contact Form 7, Yoast SEO, or caching plugins fall into this category.
    3. Characteristics: Medium-sized plugins include more complex functionality, like JavaScript libraries, CSS stylesheets, and some media files. They strike a balance between performance and features, making them versatile choices for many WordPress sites.
  3. Large Plugins (Complex or Premium Features)
    1. Size Range: 5 MB – 50 MB
    2. Examples: Heavy-hitters like WooCommerce and Elementor.
    3. Characteristics: These plugins pack in extensive libraries, multiple assets (JavaScript, CSS, fonts), and often include templates or bundled media files. Designed for advanced functionality, they can significantly enhance your site but may require more resources to maintain optimal performance.

Infinite Uploads

Easily manage and deliver your media with a seamless solution that simplifies video streaming optimizers storage, and ensures fast, reliable content delivery for your WordPress site.

Purchase Plugin

Increasing the Maximum Upload Size

The maximum file upload size can be increased using a variety of methods, such as:

  • .htaccess file (Apache Servers Only)
  • php.ini file
  • user.ini file
  • Using CLI
  • A plugin

Using a Plugin

We firmly believe that using a plugin is the best way to increase the maximum upload size. But, not all plugins are created equal. Some plugins attempt to modify the .htaccess file or change the php settings, but more times than not, it does not work. A plugin simply has a harder time changing server settings, because they operate on different playing fields.

But, with Big File Uploads, it doesn’t try to change any of that! Instead, it uses file chunking to process your uploads. This process takes your hosts limits (whether if that is 2MB or 8MB or XMB), and uploads the files in that size chunks. It tries to make no modifications to the server, which is why it works so easily & reliably. You still have to set an upload limit, but it can really be as high as you want it to be. However, the larger the upload limit is set, the more powerful hosting you need, and if you’re uploading a lot of files, it might be even worth it to offload your media to Infinite Uploads!

We should note that this does not work on changing the upload limit to upload WordPress theme & plugin uploads, so if you’re facing an issue with that, you will have to use one of the methods below. This also does not work on front end form submissions. This only applies to the media uploader in the media library

Big File Uploads also allows users to set the upload limit by user role. So, if you want administrators to be able to upload 256MB, Authors to upload 32MB, and Editors to upload 8MB, you can do that!

Finally, Big File Uploads also comes with a media scanner. This feature allows you to see what media is on your site and provides a comprehensive breakdown of storage usage across different file types, including images, videos, code, and more. The media scanner not only categorizes the files but also gives you an exact count of how many files exist in each category. This can be incredibly useful for maintaining an organized media library and managing your site’s storage space effectively.

Understanding the storage distribution helps in optimizing your site’s performance by identifying which file types are consuming the most space. It also aids in making informed decisions about which files to keep, compress, or delete, ensuring that your WordPress site runs smoothly without unnecessary bloat. This feature is particularly beneficial for sites with extensive media libraries, where keeping track of file sizes and types can become cumbersome.

Using the .htaccess File

Locate the .htaccess File

The .htaccess file is usually located in the root directory of your WordPress installation (the same directory as wp-config.php). If the file is hidden (files starting with a dot are often hidden), make sure your FTP client or file manager is set to display hidden files. If no .htaccess file exists, create a new file in the root directory of your WordPress site and name it .htaccess.

3. Add PHP Configuration Directives

Open the .htaccess file in a text editor and add the following lines at the bottom:

php_value upload_max_filesize 128M
php_value post_max_size 128M
php_value memory_limit 256M
php_value max_execution_time 300
php_value max_input_time 300
  • Explanation of Each Directive:
  • php_value upload_max_filesize: Maximum size for an uploaded file (e.g., 128M = 128 megabytes).
  • php_value post_max_size: Maximum size for all POST data (files + other POST data).
  • php_value memory_limit: Maximum memory that PHP scripts can use.
  • php_value max_execution_time: Maximum time (in seconds) a script can run before timing out.
  • php_value max_input_time: Maximum time (in seconds) PHP will spend parsing input data.

Save and Upload the .htaccess File

Save your changes and upload the file back to the root directory using an FTP client or your hosting provider’s file manager.

Verify the Changes

To ensure the changes have taken effect, create a phpinfo.php file in the root directory of your WordPress site. Add the following code:

<?php
phpinfo();

Visit the file in your browser (e.g., http://yourdomain.com/phpinfo.php) and check the updated values for upload_max_filesize, post_max_size, and other parameters.

Using the php.ini File

Use .php.ini when you have permissions to modify PHP configurations and .user.ini or .htaccess is not effective.

Locate or Create the php.ini File

Check if your server already has a .php.ini file in the root directory of your WordPress site or the directory where PHP is configured to look for it. If it doesn’t exist, create a new file and name it .php.ini.

Add or Update the PHP Directives

• Open the .php.ini file in a text editor.

• Add or modify the following lines to specify the desired limits:

upload_max_filesize = 128M
post_max_size = 128M
memory_limit = 256M
max_execution_time = 300
max_input_time = 300

Explanation of Each Directive:

  • upload_max_filesize: Maximum size of an uploaded file.
  • post_max_size: Maximum size of all POST data, including files.
  • memory_limit: Memory allocation for PHP scripts.
  • max_execution_time: Time (in seconds) a script is allowed to run before timing out.
  • max_input_time: Time (in seconds) PHP scripts will parse input data.

Save and Upload the File

Save the .php.ini file and upload it to the root directory of your WordPress site using an FTP client or your hosting provider’s file manager.

Verify the Changes

To ensure the changes have taken effect, create a phpinfo.php file in the root directory of your WordPress site. Add the following code:

<?php
phpinfo();

Visit the file in your browser (e.g., http://yourdomain.com/phpinfo.php) and check the values for upload_max_filesize and post_max_size.

Using the .user.ini File

.user.ini is ideal for hosting environments that do not allow direct access to php.ini or where .htaccess adjustments don’t work (e.g., when PHP is running in FastCGI mode). If the file is hidden (files starting with a dot are often hidden), make sure your FTP client or file manager is set to display hidden files.

Locate the Root Directory of Your WordPress Site

The .user.ini file should be placed in the root directory of your WordPress installation (where wp-config.php is located). If the file doesn’t already exist, create a new one. Use a text editor like Notepad++ or a command-line editor (e.g., nano or vim in Linux). If the file exists, edit it.

Add PHP Directives for Upload Size

Include the following lines in your .user.ini file:

upload_max_filesize = 128M
post_max_size = 128M
memory_limit = 256M
max_execution_time = 300
max_input_time = 300

Save and Upload the File

Save the file and upload it to the root directory of your WordPress installation using FTP or your hosting provider’s file manager.

Verify the Changes

Create a phpinfo.php file in the root of your WordPress directory to confirm the changes. Add the following code to the file:

<?php
phpinfo();

Access this file in your browser (http://yourdomain.com/phpinfo.php) and look for the updated values under upload_max_filesize, post_max_size, and other parameters.

Restart Your Web Server (If Necessary)

Depending on your hosting environment, the changes may require a server restart. Some shared hosting setups apply .user.ini changes automatically, while others may need you to restart PHP processes.

Alternative Methods

If you’re unsure about modifying server configurations on your own & a plugin method won’t work, reaching out to your hosting provider is a reliable option. Hosting providers typically have the necessary access and expertise to adjust server settings safely. They can help you increase the maximum file upload size, ensuring it aligns with your website’s requirements without compromising security or performance. Additionally, hosting providers may offer guidance on optimizing your server settings for better file handling and provide insights into any limitations based on your hosting plan. This can be particularly useful if you’re using shared hosting, where server resources are limited and need careful management.

Uploading Large Files via FTP/SFTP

Upload Files via FTP/SFTP

1. Connect to Your Server

  • Use an FTP client like FileZilla or an SFTP client to connect to your server.
  • Enter your FTP/SFTP credentials provided by your hosting provider.

2. Navigate to the WordPress Uploads Directory

  • Go to the /wp-content/uploads/ folder.
  • Inside the uploads folder, organize your files by year and month (e.g., /wp-content/uploads/2025/01/).

3. Upload Your Files

  • Drag and drop your large files into the appropriate folder. For example:
/wp-content/uploads/2025/01/largefile.mp4

Step 2: Register the Files in the WordPress Media Library

Files uploaded directly via FTP/SFTP do not automatically appear in the WordPress Media Library. You need to register them in the database.

Option 1: Use a Plugin (Recommended)

  • Install a plugin like Media Sync or Add From Server.
  • Steps for Media Sync:
    • Install and activate the plugin.
    • Go to Media > Media Sync in your WordPress dashboard.
    • Scan for files.
    • Select the files you uploaded and click Import to Media Library.
    • The files will now appear in your Media Library.

Option 2: Manual Method (Advanced)

If you prefer not to use a plugin, you can manually register the files in the database:

  1. Database Access: Use a tool like phpMyAdmin or Adminer to access your WordPress database.
    1. Insert Metadata:
      1. Add an entry for each file into the wp_posts table with:
      2. post_type = ‘attachment’
      3. post_mime_type set based on file type (e.g., image/jpeg, video/mp4).
      4. guid set to the file’s URL (e.g., https://example.com/wp-content/uploads/2025/01/largefile.mp4).
      5. Insert metadata into the wp_postmeta table for wpattached_file with the relative path (e.g., 2025/01/largefile.mp4).
  2. Automate with code
    1. Use a PHP script to programmatically register the files. Add this to a custom plugin or theme’s functions.php:
function add_file_to_media_library($file_path) {
    // Check if file exists
    if (!file_exists($file_path)) {
        return new WP_Error('file_missing', 'File does not exist');
    }
    $upload_dir = wp_upload_dir();
    
    // Check for upload directory errors
    if ($upload_dir['error']) {
        return new WP_Error('upload_dir_error', $upload_dir['error']);
    }
    $file_name = basename($file_path);
    $file_url = $upload_dir['url'] . '/' . $file_name;
    $attachment = array(
        'guid'           => $file_url,
        'post_mime_type' => mime_content_type($file_path),
        'post_title'     => preg_replace('/\.[^.]+$/', '', $file_name),
        'post_content'   => '',
        'post_status'    => 'inherit'
    );
    // Insert attachment and check for errors
    $attach_id = wp_insert_attachment($attachment, $file_path);
    if (is_wp_error($attach_id)) {
        return $attach_id;
    }
    // Make sure required image file is loaded
    require_once(ABSPATH . 'wp-admin/includes/image.php');

    // Generate and update metadata
    $attach_data = wp_generate_attachment_metadata($attach_id, $file_path);
    if (is_wp_error($attach_data)) {
        return $attach_data;
    }
    wp_update_attachment_metadata($attach_id, $attach_data);
    return $attach_id;
}

Important Considerations

On many occasions, users request a larger file size upload because they have not been taught how to resize an image before sending it to the server or that they are choosing the wrong file type. For example, they might be uploading RAW or TIFF files for photos where JPEG would be significantly smaller. As a site owner, always double-check if this is a training issue or something that would warrant making changes to your server configuration.

Additionally, it’s crucial to understand the impact of large file uploads on your site’s performance and loading speed. Large files can slow down your site, affecting user experience and potentially harming your SEO rankings. Educating users on the benefits of using optimized file formats not only saves server space but also enhances the overall performance of your WordPress site. Tools and plugins are available that can automatically compress and optimize images upon upload, ensuring that your media library remains efficient and manageable.

Consider implementing a workflow or guidelines for content creators and site contributors to follow when uploading media files. This can include instructions on preferred file types, maximum dimensions for images, and recommended compression settings.

By addressing these issues proactively, you can maintain a balance between functionality and performance, ensuring that your WordPress site remains responsive and efficient even as media demands grow.

Infinite Uploads

Easily manage and deliver your media with a seamless solution that simplifies video streaming optimizers storage, and ensures fast, reliable content delivery for your WordPress site.

Purchase Plugin

Conclusion

When considering increasing the maximum upload size, it’s important to understand the implications of each method. Modifying the .htaccess file or php.ini file involves accessing and editing core server files, which can be risky if not done correctly. These methods require careful attention to detail and a good understanding of server configurations. On the other hand, using a plugin offers a more straightforward solution that minimizes the risk of errors and server misconfigurations. Plugins like “Big File Uploads” not only simplify the process but also provide additional features such as setting user-specific upload limits and utilizing file chunking to bypass server restrictions.

Moreover, increasing the maximum upload size is crucial for websites that handle large media files, such as high-resolution images, videos, or extensive audio files. It ensures that the media library can accommodate the necessary files without hindrance, facilitating smooth content management and site functionality. For businesses relying heavily on media content, having a larger upload size can significantly enhance productivity and user experience.

If you’re exploring managed WordPress hosting options, consider the benefits of faster load times, enhanced security features, and expert support. Managed hosting solutions often come with optimized server settings that can handle larger file uploads more efficiently, reducing the need for manual adjustments and ensuring that your website performs at its best. Our expert team is ready to assist you in selecting the best hosting solution tailored to your specific needs, ensuring a seamless and efficient WordPress experience.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Recent Post

Infinite Uploads Joins ClikIT

Infinite Uploads Joins ClikIT

We’re excited to announce that Infinite Uploads, along with the popular Big File Uploads plugin, has been acquired by ClikIT! Infinite Uploads empowers WordPress sites to offload their media libraries to the cloud and deliver content seamlessly through a content...

Join the Infinite Uploads Affiliate Partner Program

Join the Infinite Uploads Affiliate Partner Program

The all new Infinite Uploads Affiliate Partner Program is live, and you can earn as much as $3,300 in recurring income per referral! We believe that when it comes to reaching new audiences your voice, happy users and industry experts are by far the most...

Newsletters

Written By

Owner of ClikIT, Blake has been involved in WordPress since 2014. Once designer & developer, now he manages the team at ClikIT and provides project management & strategic vision to their clients. Now, he’s leading the change at ClikIT to become a plugin company.

Create Your Account And Start Exploring

Try the Infinite Uploads plugin and discover all its benefits. By registering, you’ll gain access to technical support, receive updates, and enjoy exclusive content. Don’t wait any longer and join us today!