Quantcast
Channel: Azhar Kamar » PHP
Viewing all articles
Browse latest Browse all 10

How to Increase the Maximum File Upload Size in WordPress

0
0

My blog has been using the Download Monitor WordPress plugin for about 2 years now and I’ve been loving it since. So when a client wanted a function whereby admins can upload files from the backend for registered users to download from the frontend, I immediately knew which WordPress plugin to turn to.

So I plugged in Download Monitor on my client’s Wordpress site and off it went, doing it’s download-monitoring magic.

Until one day, one user reported a bug – certain files aren’t uploading successfully. Since I had experienced a similar issue before during my Joomla days, my mind instantly inclined towards the maximum file upload size issue.

After some lolcats and rage comics and serious troubleshooting, it was confirmed – The maximum file upload size was the culprit.

It was set to a low 8MB, hence when the user uploads files bigger than that, the process simply fails (unfortunately without an error message for the poor clueless user).

How to Increase the Maximum File Upload Size

After a few Google searches, I finally solved this with the help of WPBeginner.

Just follow the steps below in order. After completing each one, check whether the problem was fixed. Cause if step 1 solved the issue, you wouldn’t need to proceed to step 2, and so on. As for me, I had to go till step 3. ;(

1. Edit your Theme’s Functions.php

Copy these to your theme’s functions.php file, before the closing ?> tag. The file should be here /wp-content/themes/your-theme/functions.php.

@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '64M');
@ini_set( 'max_execution_time', '300' );

Now try uploading a big-sized file. Nothing happened? That’s pretty normal. Go on to the next step.

2. Create / Edit the php.ini file

This php.ini might be the culprit. Login to your FTP client and check if this file is in the root directory. If it is, append/edit as follows. If you can’t find the file in your root, chances are your site is hosted in a shared server hence you’ve gotta create one for yourself with the codes below.

upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300

3. Add a Few Lines to the .htaccess File

This was the step that worked for me. If you’re here, chances are you’re feeling down, so I hope this one works for you too. If it doesn’t, you might wanna contact your hosting provider.

The .htaccess file is located in your site’s root directory.

Just copy these codes into the bottom of your .htaccess file, before # END WordPress.

php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300


Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images