How to Upload Large Images to WordPress

Upload Large Files to WordPress
By Aditya Samanta Updated

Having trouble uploading large images files to WordPress? You are not the only one. Most web hosts set a file size limit on uploads. This stops users from uploading huge files. In this article, we will show you how to increase this limit and Upload Large Images to WordPress.

WordPress upload limit

If you want to check your upload limit then visit the Media Uploader. Go to Dashboard > Media > Add New.

media uploader

You can see your current u pload limit at the bottom. Some hosts have this set to a reasonable file size (8mb). While some hosts have this set to a value as low as 2mb (shared hosts). If you try to upload a file larger than your current upload limit, then WordPress will start complaining about upload limit file size.

Maximum upload file size is a server side setting. It has nothing to do with WordPress. WordPress Dashboard won’t be of any help here. To upload large images to WordPress, you will have to manually edit some files. Depending on your server configuration, this file may be your theme functions.php file, servers php.ini file or servers .htaccess file.

Note that some hosts don’t allow the manual increase of file size upload limit. In those cases, you will have to contact your host support team.

Think before you upload large images to WordPress

Internet speed continues to rise and bandwidth limits are getting lifted. Downloading large files is less of an issue now. But not all users have access to high-speed internet. Raw images will take forever to load on a slow internet connection. Do you really think your users will wait that long?

Raw high-resolution images look excellent but they have huge file size. Consider compressing images. File size will be much smaller. In most cases you won’t notice any quality loss. There are lots of tools available online that compress images. It’s well worth checking them out.

Speed plays a huge role in SEO ranking. Google doesn’t like slow sites. Unless you are creating a photo website, use compressed images. You will have a reasonable combination of speed and quality.

Now let’s see what we can do to increase the upload limit so that we can upload large files to WordPress media library.

functions.php file

Your safest bet is to start with your themes functions.php file. Open the file using an FTP client and add the following lines of code. You can place it anywhere in the functions.php file.

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

If the code doesn’t work, then try changing the file size from 64M to 8M. If it still does not work, then try the next method.

php.ini file

This is a common method and works for most users. php.ini is the configuration file used by PHP itself. The main PHP configuration file may not always be available. Find you php.ini file in your WordPress installation root directory. In case the file is not available, you will need to create a new one. Just create a new empty file and name it php.ini. Paste the following code in it, save and upload the new file.

upload_max_filesize = 64M
post_max_size = 64M

Again, if this doesn’t work, try changing the file size to 8mb. Please note that depending on your host and hosting plan, the file name may be php.ini, php5.ini or user.ini. Consult your host support team if you are unsure.

.htaccess file

I say this all the time and I am gonna say it again. Be very careful when editing this file and make sure you take a backup. Slight mistake and you will be cursing yourself.

You can find the .htaccess file in the server root directory. Make sure hidden files are visible. Paste the following lines of code.

<IfModule mod_php5.c>
 php_value post_max_size 128M
 php_value upload_max_filesize 128M

Save and upload the file. Your problem should be fixed.

If you are are still not able to upload large images to WordPress, you will need to contact your host. Tell them that you want to increase the maximum upload file size limit in the WordPress media library. They will increase it for you.

Did you found this article useful? Let us know in the comments section below. Share with us if you know something we missed.