How website owners will find enough server capacity to handle large media uploads is the technical challenge of modern WordPress management. One of the most important configurations involves the PHP upload_max_filesize directive, a server setting that controls the maximum size of files users can upload. The problem is that many hosting providers set this limit very low, and on shared hosting plans, users often lack the direct access to change it. This restriction on file uploads complicates the work of building rich, media-heavy websites. A proposal from a developer might steer clear of the most complex server-level edits, but it nonetheless seeks practical solutions by adjusting settings within WordPress itself and through careful platform selection for content-heavy projects.
How to Increase the Upload Max File Size in WordPress
Hitting the "uploaded file exceeds the upload_max_filesize directive" error can stop your workflow. Don't worry, increasing this limit is a common task. The solution involves a multi-layered approach, starting with the easiest methods before moving to more advanced server configurations. Think of it as checking the most accessible controls first. Here is a clear, step-by-step guide to troubleshoot and resolve this issue.
- Step 1: Check Your Current Limits: First, know what you're working with. Install a plugin like "WP Server Info" or look for a "Site Health" tool in your hosting dashboard. This will show you the current upload_max_filesize and post_max_size values set by your host.
- Step 2: Use a WordPress Plugin: The simplest method is a dedicated plugin. Search for "Increase Maximum Upload File Size" in your WordPress plugin directory. These tools often provide an interface to raise the limit with one click, though their effectiveness depends on your host's permissions.
- Step 3: Modify the functions.php File: You can add code to your theme's functions.php file. Inserting
@ini_set( 'upload_max_size' , '64M' );and@ini_set( 'post_max_size', '64M');can sometimes override the server settings. Remember to use a child theme to avoid losing changes during updates, a process similar to safely removing unused theme files. - Step 4: Edit or Create a php.ini File: If you have access, create or edit a file named php.ini in your website's root directory (or wp-admin folder). Add the lines:
upload_max_filesize = 64Mandpost_max_size = 64M. Save and upload it back to your server. - Step 5: Edit the .htaccess File: For servers running Apache, you can add directives to your .htaccess file. Include code like
php_value upload_max_filesize 64Mandphp_value post_max_size 64M. Be very careful, as a mistake here can break your site. - Step 6: Contact Your Hosting Provider: If the above steps fail, your host likely restricts these changes. Contact their support and ask them to increase the upload_max_filesize and post_max_size for your account. This is often the most reliable solution.
What is the default max upload size in WordPress?
The default maximum upload size in WordPress is not set by WordPress itself, but by your hosting server's PHP configuration. Most shared hosting providers set this limit between 2MB and 8MB. You can check your specific limit by going to your WordPress dashboard, navigating to Media > Add New, and looking at the text below the uploader. This size is controlled by the upload_max_filesize directive in PHP, which is a key factor when planning a site that needs to handle high-resolution images or video content, especially if you're considering optimizing for visitors on all devices.
How do I fix upload_max_filesize in PHP?
Fixing the upload_max_filesize involves editing server configuration files. The primary file is php.ini. Locate this file via your hosting control panel (like cPanel's File Manager or a "PHP Configuration" tool). Find the line for upload_max_filesize and change its value, for example, to 128M. Crucially, you must also increase the post_max_size directive to a value larger than your new upload limit. After saving, restart your web server for the changes to take effect. If you cannot find a php.ini file, you may need to create one in your website's public root directory with the new values. Understanding these core files is as fundamental as knowing how to edit other key parts of your website's text and code.
upload_max_filesize vs post_max_size: What's the difference?
These two PHP settings work together but control different things. The upload_max_filesize dictates the maximum size for a single file being uploaded. The post_max_size sets the total allowed size for the entire POST request, which includes the file plus any form data. Therefore, post_max_size must always be set to a value larger than upload_max_filesize. If they are equal, the form data overhead can cause the total request to exceed the post limit, resulting in an upload failure. Getting this configuration right is essential for complex forms, much like ensuring proper integration between your page builder and external CRM systems is key for functionality.
| Directive | Purpose | Recommended Setting |
|---|---|---|
| upload_max_filesize | Maximum size for one uploaded file. | e.g., 64M |
| post_max_size | Maximum total size of POST data (file + form fields). | e.g., 128M |
| max_execution_time | Maximum time a script can run (important for large uploads). | 300 |
Can I change the upload size without accessing php.ini?
Yes, you often can. The first place to try is your hosting control panel. Many hosts like SiteGround, Bluehost, or WP Engine provide a "PHP Settings" area where you can adjust these values with dropdown menus. If that's not available, using a WordPress plugin designed for this purpose is the next easiest method. As a last resort, you can add configuration lines to your .htaccess file (for Apache) or user.ini file. However, success without direct php.ini access depends entirely on your host's security policies. Some hosts lock these settings on shared plans to maintain server stability, which can affect all pages and subdomains under your hosting account.
Why is my upload limit still low after changing php.ini?
If your upload limit remains low after editing php.ini, the most common reason is that WordPress is reading a different configuration file. Servers can have multiple php.ini files in different directories. Ensure you've edited the correct one that applies to your website's root or specific directory. Another possibility is that you need to restart your web service (like Apache or LiteSpeed) for the changes to load. Also, check that you have correctly edited both the upload_max_filesize and the larger post_max_size values. Finally, some managed WordPress hosts override local php.ini files with their own global configuration, requiring you to contact support. Creating a clear link structure within your site's help documentation can help users find these troubleshooting tips.
Professional WordPress Services at WPutopia
Struggling with technical server limits like upload_max_filesize is exactly the kind of hassle our WordPress services are designed to handle. At WPutopia, we take care of the backend complexities so you can focus on creating content and growing your business. Our expert team manages everything from routine maintenance and security updates to plugin installation and performance optimization, ensuring your site