Uploading Large Image Files in WordPress

how to upload large image files in wordpress

Webmasters who have image oriented websites such as portfolios, image galleries and similar sites they always have one issue to deal with which is how to upload large size images in wordpress. Recently quite a few of our readers asked how they can upload images of large size in their wordpress powered websites. Generally your web server will show upload limit error when trying to upload an image that exceeds the allows upload limit. It happens because of the file size limit. In this guide we will provide you with an in-depth walkthrough to fix the image upload limit error.

So, why are you not allowed to upload large images in wordpress? Well simple answer would be that your web hosting company may have setup or configured their servers to allow a particular file size and if you exceed that number it declines that image upload with and error message. To view this file size limit you can go to your wp-admin >> Media >> Add New Page.

You are most likely to see an error saying “image.png exceeds the maximum upload size for this site” if your host has set the limit lower than the image file size you are uploading. On the other hand you may also expeirnce other issue which is related to memory limit that shows an error when uploading a very large image file.

Generally by default a wordpress setup allows users to use a reasonable amount of memory and if the upload exceed that then it returns and error message. It happens because the script runs for too long and that result in exhaustion of defined memory limit of the web server. In case you are running into one of these upload related errors, then this guide will help you fix the problem and you will be able to upload large image files with ease.

If you are running an image intensive wordpress blog or website and want to upload large media files and images, then code below will allow you to fix the upload size error in wordpress. All you have to do is to copy the code we have provided below, paste it in functions.php file and save it.

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

What the code does is, it will increase the maximum file size upload limit, post maximum size and maximum exception time as well. Having said, this code may not work on some wordpress website and if it doesn’t work for you, you can add the code below in the .htaccess file that you can find in your wordpress website’s root directory.

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

If you still can’t get this to work to fix the issue, then you have the third option to adjust the size limit settings in the php.ini file. This is core settings file used by PHP for configuration. Generally wordpress users who are using shared web hosting services do not have access to php.ini file. But you still have an option to create an empty php.ini file in the root directory of the wordpress website by using an FTP application such as FileZilla and others.

To do this simply open the root directory of your wordpress website using an FTP client and create a new php.ini file in it and paste the following code in it:

upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300

We hope you have now successfully fixed the upload limit error but in case you still not able to resolve this, the bets option is to get help from your web hosting provider and they will fix it for you. Having said that, even if you have resolved the upload limit error, you need to ask yourself that do you really need to use large size image files? Because heavy images take so much time to load and makes your website slow which is never a good thing to do in terms of improving users expeirnce of your website.

Search engines such as Google and Bing recommend using low size image files because it makes pages load faster. Therefore if you use heavy image files, it will impact on your on-page SEO and your pages may not rank higher in search engines. If you still want to use large image files for some reason, we recommend using image compression services that reduce file size without losing quality of the image.

Leave a Reply

Your email address will not be published. Required fields are marked *