Your WordPress site has a set limit for file uploads, depending on various factors. If you try to upload a file exceeding this limit, an error message will pop up. To check your limit, go to Media → Add New. As a top Website & Software Company in Kochi, we prioritize seamless website management for an efficient online experience
You can make the upload size bigger by making changes to your php.ini file, but this may not be possible with all hosting plans. So, it’s a good idea to contact your hosting provider or consider compressing your images instead.
How to Resolve the upload_max_filesize Error in WordPress?
When aiming to upload larger files on your WordPress site, adjusting the file size settings becomes essential. This task can be handled independently or with support from your web hosting team. Here are effective ways to resolve the ‘uploaded file exceeds the upload_max_filesize’ error in WordPress:
- Tweak settings in the php.ini file.
- Edit the .htaccess file.
- Modify the wp-config.php file.
- Fine-tune the maximum upload size in cPanel.
- Implement changes in the theme’s functions.php file.
Should you encounter challenges, reaching out to your hosting support is advisable. As a reliable Website & Software Company in Kakkanadu, Ernakulam (Kochi), we are well-versed in these intricacies and offer comprehensive assistance for a seamless website experience.
Updating php.ini file
Every server has a file called php.ini, and it’s usually located in the wp-admin folder. You’ll need to open this file and change the memory limit setting to a new value.
However, there’s a catch. php.ini files control how your server works, but sometimes, on certain servers, you might not be allowed to modify them.
If you have your websites on a VPS or dedicated server, you can access and edit the php.ini file. But if your websites are on shared hosting, you probably won’t have the option to edit it.
If you’re using cPanel, you can go to the Files section and click on the File Manager button. Make sure to check the box that says ‘Show Hidden Files’ and then click ‘Go’.
Go to your wp-admin folder and check if there’s a file named php.ini or php5.ini (usually located in /etc/php.ini). If you don’t find it, you can create one by clicking the ‘New File’ button in the top left-hand corner. Name the file php.ini and click ‘Create File’ on the pop-up. If it still doesn’t work, try renaming it to php5.ini.
If the file already exists, look for three settings and adjust them if needed. If you’ve just created the file or can’t find these settings, you can paste the following code:
upload_max_filesize = 12M
post_max_size = 13M
memory_limit = 15M
These values represent megabytes. You can change them to suit your needs, but usually, the upload_max_filesize should be the smallest, memory_limit the largest, and post_max_size somewhere in between.
You can set values higher, like 256M or more, but it’s usually not necessary (and not recommended). After making changes to the php.ini file, save it. Then, refresh your website and try uploading the file again.
Editing .htaccess file
editing the PHP.ini file didn’t work, you can try fixing the issue by editing your site’s .htaccess file. The .htaccess file is a special hidden file that contains settings to adjust how the server behaves.
This method is simpler and often used when your website is hosted on shared hosting. The steps are the same. Log in to your web hosting account, go to cPanel, click on ‘FILES,’ then ‘File Manager.’ Navigate to the Document Root for your site, and make sure the ‘Show Hidden Files’ checkbox is selected.
Next, locate the .htaccess file and open it. Then, add the following code to the bottom of the file (or modify it if it’s already there):
php_value upload_max_filesize 12M
php_value post_max_size 13M
php_value memory_limit 15M
You can adjust these values to match your requirements. After making changes, save the .htaccess file.
Note: If you can’t find the .htaccess file in your main directory, you can create a new file and name it .htaccess.
If the previous methods didn’t help, you can attempt to fix the issue by editing the wp-config.php file in your website’s main folder. Simply add the following line to the very bottom of the wp-config.php file, just before the ‘happy blogging’ part:
This might increase your website’s memory limit to 128 megabytes.
Changing maximum upload size in cPanel
If your hosting provider uses cPanel and permits PHP setting adjustments, you can raise the maximum file upload size easily. Just log in to cPanel and search for ‘Select PHP version’ under the Software section.
Click on Change to PHP options.
Change the post_max_size and upload_max_filesize values.
Click on Save button to save the changes.
Edit Theme Functions.php
You can attempt to increase your website’s upload limit by editing your theme’s functions.php file.
To do this, open the functions.php file located in your current WordPress Theme (usually in /wp-content/themes/…). Then, add the following code to the file:
@ini_set( ‘upload_max_size’ , ‘128M’ );
@ini_set( ‘post_max_size’, ‘128M’ );
@ini_set( ‘max_execution_time’, ‘600’ );
Save the changes after adding this code.
Get Help from Your Web Hosting Support
If none of the previous methods fixed the issue, reach out to your web hosting’s support team. It’s possible that your web host has set restrictions on file sizes, and they might need to assist you in resolving this
Increase the upload_max_filesize in php.ini
You can easily raise the upload_max_filesize through your hosting’s File Manager, which is the simplest method and provides a quick solution.
Alternatively, you can achieve this using FTP or SSH connections. Below, you’ll find more details on each method.
Using File Manager
If you want to increase the upload_max_filesize for your website, you can change the php.ini file using the File Manager. Here’s what to do:
- Go to the main folder of your WordPress site (usually named public_html) in the File Manager.
- Look for the php.ini file. If you can’t find it, you can create the file yourself and then put the following code inside it:
upload_max_filesize = 256M
- post_max_size = 256M
After you’ve changed the values like in the screenshot, click ‘Save.’ To make sure these changes work, clear both your website’s cache and your browser’s cache.
Now, try uploading the file again to see if the ‘upload max filesize’ error still appears.
You can also modify the php.ini file using an FTP connection. To do this, you need an FTP account and login using your FTP client. In this example, we’ll use the FileZilla FTP client.
- Input your login details to connect.
- After connecting, open the public_html folder.
- Locate the php.ini file as shown in FileZilla.
- Right-click and choose ‘View/Edit.’ FileZilla will prompt you for your selection.
- Copy the code snippet from before and paste it into your php.ini file.
- Confirm the changes and give FileZilla a moment to upload the updated file.
After that, clear your caches, and attempt to upload the file again. You can now try to upload the file you originally intended.
An advanced approach is to edit the php.ini file using an SSH connection. To increase the upload_max_filesize, follow the steps below.
Here’s how you can use SSH to edit the php.ini file and increase the upload_max_filesize:
- Connect to your server using SSH from your computer.
- Navigate to your WordPress site’s main folder with this command:
- cd /path/to/your/wordpress
- For example, if your website is testsgdomain.com, the path might be:
- Open the php.ini file with your preferred text editor:
- Add the following line to the file and save it:makefile
upload_max_filesize = 256M
- Clear your caches and attempt to upload the file again.
- If you’ve followed these steps correctly, the WordPress error message “the uploaded file exceeds the upload_max_filesize directive in php.ini” should no longer appear.
How We Can Support You?
With a solid foundation in Kakkanadu, Ernakulam (Kochi), and over 12 years of industry expertise, we stand out as a prominent player in the IT landscape, offering sophisticated and dependable services. Whether embarking on a new project, seeking support for existing systems, or requiring expert IT consultation, we are dedicated partners in your journey to success. Beyond development, we are committed to being your progress partners, tailoring solutions to align with your specific objectives. Collaborating closely with you, we turn your vision into reality.
For all your IT needs, including Website Development, Software Development, Mobile App Development, and expert consultation, contact us. Let’s together unlock the full potential of technology and propel towards greater heights. As a distinguished Website & Software Company in Kochi, we assure comprehensive solutions that reflect our commitment to excellence.
Frequently asked questions
Dieutek Developments is located in Kakkanadu, Ernakulam (Kochi), with over a decade of experience in delivering high-quality IT solutions.
Dieutek Developments provides a comprehensive range of IT services, including website development, website redesign, custom software development, ecommerce store development, web and mobile app development, and digital marketing.
Certainly, Dieutek Developments offers concept-to-completion website development and website redesign services to cater to clients' specific needs.
Dieutek Developments excels in building ecommerce stores, providing customization options and expertise in integrating various platforms and tools, along with payment gateway integration both domestically and internationally.
Yes, Dieutek Developments offers mobile app development services for Android, iOS, Flutter, and hybrid platforms.
Absolutely, Dieutek Developments offers IT consultation services to assist clients in Kakkanadu, Ernakulam (Kochi), in aligning their IT strategies with their business goals.
Dieutek Developments has expertise in various industries, including Healthcare, Retail, E-commerce, Restaurants, Church, Education, NGO, Travel & Tourism, and Entertainment, providing tailored IT solutions for each sector.
Dieutek Developments boasts a team of 35+ professionals with over 13 years of experience in the IT industry, based in Kakkanadu, Ernakulam (Kochi).
In summary, if you come across the “uploaded file exceeds the upload_max_filesize” error in WordPress, the solution lies in adjusting settings within the php.ini, .htaccess, wp-config.php files, or through your hosting’s cPanel. Alternatively, you can increase the upload_max_filesize using File Manager, FTP, or SSH connections. Should you encounter difficulties, don’t hesitate to seek assistance from your hosting support. As a trusted Website & Software development company in Kakkanadu, ernakulam (Kochi), we offer a range of IT services and consultation, covering everything from website and software development to mobile app development, ensuring tailored support for your unique requirements and helping you achieve your goals.