How to fix “the uploaded file exceeds the upload_max_filesize directive in php.ini” Error?

WordPress is the best content management system to build websites of almost any type and complexity. It does not require deep knowledge of coding, so, it is the best choice for everyone. You can install WordPress manually or depending on your web host you can also install it in one click. While uploading the files into WordPress, you may face the “the uploaded file exceeds the upload_max_filesize directive in php.ini” error.

At WPOven you can install a WordPress site to your server in a matter of seconds and easily manage it from our dashboard. Moreover, it is very customizable: you can easily change the interface or add new functionality just installing the new themes or plugins. You can read more about common errors here (DNS_PROBE_FINISHED_NXDOMAIN, 404 error, 504 gateway timeout, 403 Forbidden)

Video Tutorial

What does this error mean? Why does WordPress display it? What are the ways to fix this error? Let’s look closer.

What is the uploaded file exceeds the upload_max_filesize directive in PHP.ini error?

Depending on the platform you host your website on, your WordPress may have different maximum file size limits. In most cases, it is 64 MB, but sometimes it can be higher or significantly lower. How does it affect your work?

For example, in the WordPress configuration or php.ini file, you have a limit of 64 MB. And you are going to install the theme, plugin or just upload the media file which is bigger. In this case, the server will throw “the uploaded file exceeds the upload_max_filesize directive in php.ini” error, and you will not be able to upload the file.

What are the ways to fix the issue? We’ll review four of them.

How to fix the uploaded file exceeds the upload_max_filesize directive in php.ini?

  1. Editing the .htaccess file
  2. Edit the wp-config.php file
  3. Edit php.ini file
  4. Contact the support

Editing the .htaccess file –

.htaccess is an Apache Web server configuration file. It allows you to configure the settings for individual folders and users. The .htaccess file provides a wide range of website customization. The maximum file size is one of the parameters you can set up in this file.

You can find the .htaccess file is in the root folder of your website. To access it, you will require either an FTP manager or web interface given by the hosting provider. In the case of FTP manager, you will need the IP address, login, and password to connect remotely. Usually, this information is provided by the hosting. If you are a WPOven user you can get the SFTP details as mentioned here.

.htaccess view
  • Open the file in any text or code editor, like Sublime Text, Visual Studio Code, Notepad++, etc. Then find the upload_max_filesize line. It will look like that:
  • In some cases, the .htaccess file may not contain this line. Then, add it at the end of the document. Change the value to the one you really need. For example:

If you did everything correctly, WordPress will not display this error anymore.

Edit the wp-config.php file-

wp-config.php is the main configuration file of your WordPress website. It contains all the important parameters tool to make the website work correctly. It is also located in at the website root folder. Like a .htaccess file, you will need is an FTP manager or web browser if you access it online.

Edit the wp-config.php file
  • Open the file in any text or code editor and find the following line:
  • Right after that, add the line with maximum file size parameter:

You can use any appropriate value instead of 512M.

  • Apply the changes, upload the file back to the server if you edited it offline, refresh the page, and try to upload the file again.
  • The uploaded file exceeds the upload_max_filesize directive in PHP.ini error must be now solved.

Edit php.ini file-

The uploaded file exceeds the upload_max_filesize directive in PHP.ini error Meals that something wrong with a php.ini file is going. First, let’s find out what this file is for.

The php.ini file is the main PHP configuration file. WordPress uses the PHP programming language, and this file controls everything. Some hosting providers set up its configuration to the maximum parameters and do not allow to change it globally. However, in most cases it is possible.

If you do not know where the php.ini file is located on the server, do the following steps:

  1. Start a text editor and type the following line of code in it:
  1. Save the created file and name it info.php.
  2. Via the FTP manager, connect to the hosting server where your site is located and copy the info.php file to the website root directory.
  3. Now, in the address bar of your browser type, where instead of type in your website address.

As a result, the browser displays all the information about the PHP version used on the hosting, and information about its configuration. In the Loaded Configuration File column, it will display the path to the php.ini file on the host server.

Edit php.ini file
Edit php.ini file

Among other settings, check the value of the following three parameters:

  • memory_limit — the maximum memory size allowed by the hoster to run scripts on the website;
  • post_max_size — allowed size of a one-time file import request;
  • upload_max_filesize — the maximum amount of data that can be uploaded to the site per time.

To increase the allowed maximum file size, you need to adjust the values specified in upload_max_filesize and post_max_size parameters. If you use the virtual hosting, most likely you will not have full access to the global server settings. As a rule, full access to this file is available on the local server or on a VPS hosting.

If you have access, open the php.ini file in edit mode and set the new upload_max_filesize and post_max_size values. The upload_max_filesize value should be less than post_max_size, and the post_max_size value should not be higher than the memory_limit. Do not forget to back up the site and save a backup copy of the php.ini file before you make any changes.

It must look like the following:

the uploaded file exceeds the upload_max_filesize directive in php ini

If you do not have access to the php.ini file, adjust the necessary values in the user.ini file. The path to it is indicated in the “Additional .ini files parsed” section when opening the info.php file. This method works for PHP version 5 or higher.

  1. Run a text or code editor and name the file user.ini.
  2. Add the necessary parameters to memory_limit, post_max_size and upload_max_filesize.
  3. Using the file manager, copy the user.ini file to the root directory of the site, upload the page and try to upload the file again.

Contact the support-

In many cases, it will be much easier to contact the technical support of your hosting provider and ask them to solve the issue. Remember that they may possibly not be able to change the parameters if your plan does not allow to do that. In that case, you may require to change it.

The uploaded file exceeds the upload_max_filesize directive in php.ini error is very easy to fix. All you need is several minutes of your time and some simple steps.

Frequently Asked Questions

How do I change the maximum upload size in PHP.INI?

To increaes file upload size in PHP, you need to modify the upload_max_filesize and post_max_size variable’s in your php.ini file. In addition, you can also set the maximum number of files allowed to be uploaded simultaneously, in a single request, using the max_file_uploads 

Where do I upload PHP.INI file?

ini directives, please visit For more information about the upload_max_filesize directive, please visit

Where is my PHP.INI file?

ini file is the default configuration file for running applications that require PHP. It is used to control variables such as upload sizes, file timeouts, and resource limits. This file is located on your server in the /public_html folder.

One Reply to “How to fix “the uploaded file exceeds the upload_max_filesize directive in php.ini” Error?”

  1. Great information for WordPress users. By reading this article, I got a clear idea about why the uploaded file exceeds the max file size. You nicely showed the solution which made this easier to understand.

Leave a Reply

Your email address will not be published.