Change The Upload Size Limit On WordPress

So you have created this great infographic or pdf that your readers are going to love, only you can’t load it to your site because the file is too big!

Or you want to use a Gravity form (or other form plugin) and have your website visitors send over big files with an upload button from your website.

Depending on your hosting environment, there is a pre-determined file size that PHP is allowed to upload. For some sites that limit is 2mb, not too bad, but not big enough for some larger documents, pictures, etc – so you will need to increase that limit to something larger.

Option 1 – Change the PHP configuration files

Most hosting platforms do not like us “outsiders” messing with the PHP configuration files. If you do not have this limitation with your hosting company, congratulations you can modify the files till your hearts content. But because this is such a small percentage of cases, I’m going to skip this explanation and get to the one that 99% of us can do.

Option 2 – Modify your .htaccess file

Your .htaccess file is a powerful little thing that can overwrite the default PHP settings. This is the same file that gets changed when you modify the permalinks of your site. Although there are a multitude of things we can do with this file, I’m going to concentrate on the items to increase the file size we can upload to WordPress.

First open up your .htaccess file in notepad, textpad, or your favorite coding software (I prefer Coda). You may see some code already there in my case I see:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

You will want to add the following code to this file before # END WordPress :

RewriteEngine On

php_value post_max_size 128M

php_value upload_max_filesize 128M

php_value max_execution_time 6000000

php_value memory_limit 1024M

As you can see I have set the posting max size and upload max size to 128M, I have also set the execution time to a large amount in order to allow enough time for the big file to get uploaded to the server, and I’ve increased the memory to 1024M so that there is enough memory allocated to get the job done.

Save the file and upload it to the root of your server, and you should now be able to upload files up to 128M. You may want to increase or decrease these values so they fit your particular needs.

BUT… what if this doesn’t work?

You’ve uploaded the .htaccess file to your server, breathe a sign of relief, refresh your browser… and it crashed.
Double check everything, yes it looks right.

So what’s next.

Call your web hosting company. You might be surprised to find out that you can’t edit your .htaccess file for security reasons.

So back to square one. In our case we had to set the limit to upload 200mgs (yeah I know, too much) from a website form. However the hosting company insisted it would be fine and we would have no problems. But the problem started when we couldn’t edit the .htaccess file. Next step the php.ini file. So searching through FTP folders (it should be on the top level) to find this file, make the changes and solve the problem.

No php.ini file.

Back to the hosting company. “Sorry we don’t provide one”. Meaning you wouldn’t know this until you called the hosting company. At this point it seems unlikely that we can get this *darn* upload limit changed.

Next step write your own php.ini file to change the upload limit.

Why do seemingly simple things become complicated…

Anyway here is some documentation to help you write the ‘missing’ file from some hosting companies that do not let you access the .htaccess file.

Source one – Stackoverflow
Source two – Drupal
Source three – Teknobites

Christina Rosepapa
Rosepapa Creative was founded in 2008 to provide business owners with a cohesive solution in web design and branding. With over 20 years experience in design and marketing + 15 years working in WordPress, I’ve had the opportunity to work with and assist dozens of industries throughout the USA.

Related Posts

15 Years and Strong!

15 Years and Strong!

Rosepapa Creative Celebrates 15 Years Greetings! This year marks the 15th year running of Rosepapa Creative, my professional website design and marketing services company, and I couldn’t be more thrilled to celebrate such an important milestone with...

error: Content is protected!!