The uploaded file exceeds the upload_max_filesize directive in php

     

Trying to lớn upload something lớn your WordPress site only to lớn be met with a message saying “the uploaded tệp tin exceeds the upload_max_filesize directive in php.ini”?

This error message can appear when you’re uploading large images, videos, plugins, themes, any type of tệp tin that you upload khổng lồ your WordPress site.

Bạn đang xem: The uploaded file exceeds the upload_max_filesize directive in php


In this article, we’re going khổng lồ help you fix the problem and make it so that you can upload those large files. In total, we’ll cover:

What Causes the uploaded tệp tin exceeds the upload_max_filesize directive in php.ini

*
An example of the uploaded file exceeds the upload_max_filesize directive in php.ini

Let’s start at the beginning. In order to lớn preserve your server’s resources, hosts set a limit on the maximum kích thước of a tệp tin that can be uploaded.

This maximum, in megabytes, is defined in the upload_max_filesize directive.

The upload_max_filesize directive itself is located in the php.ini file, which is the mặc định server configuration tệp tin for applications that require PHP.

Those two things – upload_max_filesize and php.ini – are what the error message you see is referencing.


Need to give a shoutout here. jdomain.vn is amazing, I use it for my personal website. The tư vấn is rapid và outstanding, and their servers are the fastest for WordPress.

*
Phillip Stemann View plans

It’s important khổng lồ remember that this upload limit is not a WordPress setting. However, you can see this limit in your WordPress site if you go to Media → add New:

*
How to check upload limit in WordPress

As you can see above, jdomain.vn sets the default limit at 128 MB, which is quite large & unlikely khổng lồ ever cause issues. However, a lot of other hosts mix the default as small as just 2 MB or 4 MB.

That means if you try lớn upload a file larger than that limit, you’re going to lớn see the “the uploaded file exceeds the upload_max_filesize directive in php.ini”, or a similar message like “file_name exceeds the maximum upload kích thước for this site.”

How khổng lồ Fix the uploaded file exceeds the upload_max_filesize directive in php.ini

In order to lớn fix this error, you need khổng lồ increase the file kích cỡ upload limit. That is, you need to increase the value of the upload_max_filesize directive in your php.ini file.

There are several different ways you can vì this – the exact method that you choose will depend on your preference & your host’s configuration.

1. Talk lớn your host’s support

While we’ll cover some methods that you can try by yourself, the simplest solution is usually to lớn just reach out to your host’s tư vấn and ask them khổng lồ increase the limit for you.

This is a common request, your host’s support should know exactly what you want, and it should only take a couple of minutes of your time. That’s what your host’s tư vấn is there for!

If you host at jdomain.vn và need lớn increase your limit beyond the default 128 MB limit, you can reach out to tư vấn on Intercom from anywhere in your jdomain.vn dashboard:

*
WordPress host support

2. Edit php.ini via cPanel

If your host uses cPanel, you should be able khổng lồ edit your php.ini file and upload_max_filesize directive via the cPanel dashboard.

First, look for the MultiPHP INI Editor:

*
The MultiPHP INI Editor in cPanel

Then choose your WordPress site from the drop-down. After that, you’ll be able lớn edit the upload_max_filesize directive for that site:


Deploy your application to jdomain.vn - Start with a $20 Credit now.

Run your Node.js, Python, Go, PHP, Ruby, Java, and Scala apps, (or almost anything else if you use your own custom Dockerfiles), in three, easy steps!

Deploy now và get $20 off
*

*
Changing the upload_max_filesize directive in cPanel

Increase the value based on your needs.

Xem thêm: Tổng Hợp Những Câu Slogan Hay Cho Công Ty Khiến Bạn Không Thể Bỏ Qua 2022

3. Create or edit php.ini via FTP

As you learned above, the php.ini file controls how your vps works for PHP applications.

Unfortunately, based on your host’s restrictions, you may or may not be able lớn use php.ini files. For that reason, a more reliable approach can sometimes be to lớn use .htaccess (which we’ll cover in the next section).

However, you can give this a try first khổng lồ see if you are allowed to lớn use php.ini at your host.

To get started, connect khổng lồ your hệ thống via FTP & go lớn your site’s root folder.

If you already see a php.ini file in the root folder, you can edit that file. Otherwise, create a new file and name it php.ini:

*
How lớn create a new php.ini file

Then địa chỉ or modify the code snippet below:


Struggling with downtime and WordPress problems? jdomain.vn is the hosting solution designed to lớn save you time! check out our features
If you created a new file, paste in the code snippet & modify the numbers to suit your needs.If you’re editing an existing file, find the same directives in the existing file & modify the numbers to lớn suit your needs.

upload_max_filesize = 12Mpost_max_size = 13Mmemory_limit = 15M

*
Adding the code to the php.ini file

Some hosts might further require you to showroom the suPHP directive in your site’s .htaccess tệp tin in order for the changes above khổng lồ actually work.

To do this, you can also edit your .htaccess tệp tin via PHP and địa chỉ the following code near the top of the file:

suPHP_ConfigPath /home/yourusername/public_html

Make sure lớn replace yourusername with the actual file path of your site.

4. Increase upload_max_filesize value by editing .htaccess

If directly creating or editing the php.ini tệp tin via the methods above didn’t work, you can also try to modify the upload_max_filesize directive by editing your site’s .htaccess file.

To get started, connect khổng lồ your site via FTP & edit the .htaccess tệp tin that’s located in your site’s root folder.

Then, add the following code snippet, making sure lớn adjust the values based on your needs:

php_value upload_max_filesize 12Mphp_value post_max_size 13Mphp_value memory_limit 15M

*
How lớn control php.ini tệp tin via .htaccess

If you get an internal vps error message after adding this code snippet, your hệ thống is likely running PHP in CGI mode, which means you cannot use these commands in your .htaccess file. Remove the snippets you just added & your site should start functioning again.

Note – if you’re a jdomain.vn customer, jdomain.vn uses NGINX, which means your site does not have an .htaccess file. If you need help at jdomain.vn, we recommend just reaching out to lớn our tư vấn team và they’ll be able khổng lồ quickly get things working for you.

Summary

To check if your changes are working, you can go back to Media → add New in your WordPress dashboard to see if the new maximum upload limit matches the number you set in your php.ini file. If all goes well, you should see your new value và you’ll be able lớn upload the file that was giving you problems.

Finally, if nothing you’ve tried is working & your host’s tư vấn can’t help for some reason, you can always upload the tệp tin via FTP as a workaround. FTP has no limits and will let you upload everything from images to plugins & themes. You can even bulk upload files if needed.


Get all your applications, databases và WordPress sites online and under one roof. Our feature-packed, high-performance cloud platform includes:

Easy cài đặt and management in the Myjdomain.vn dashboard24/7 expert supportThe best Google Cloud Platform hardware & network, powered by Kubernetes for maximum scalabilityAn enterprise-level Cloudflare integration for speed and securityGlobal audience reach with up to 35 data centers and 275+ PoPs worldwide

Test it yourself with $20 off your first month of Application Hosting or Database Hosting. Explore our plans or talk to lớn sales lớn find your best fit.


Chuyên mục: Domain Hosting