Recently, one of our users getting error when uploading large images in WordPress. Many users face this error when trying to upload larger images in WordPress. It happens due to the file size limit. In this article, we will guide you how to fix this and upload large images in WordPress.
Your WordPress hosting provider may have configured their servers with a limit on file upload sizes.
You can see this limit within your WordPress admin panel by visiting Media » Add New page.
Here if you find the file limit is lower than the file you are trying to upload, then you will definitely get an error like this:
Another problem which may keep you from posting large image is memory limit.
By standard, your WordPress site is able to use a fair amount of memory. When a program runs for too long and exhausts the described memory limit, then you will see an error.
If you’re experiencing either of these errors, then this article will help you fix so that you can easily upload huge files to WordPress.
Fixing Image Upload Size in WordPress
If you want to upload large image and media files in WordPress, so here is how you can fix image upload size issue in WordPress.
Simply add this code in your theme’s functions.php file.
@ini_set( 'upload_max_size' , '100M' ); @ini_set( 'post_max_size', '100M'); @ini_set( 'max_execution_time', '300' );
This code tries to increase maximum upload file size, post maximum size, and maximum execution time limits for your WordPress site. However, this may not work for some WordPress websites.
In that case, you may try adding following code to your .htaccess file in your site’s root folder.
php_value upload_max_filesize 100M php_value post_max_size 100M php_value max_execution_time 300 php_value max_input_time 300
If both of these methods don’t succeed, then you can try modifying these rules using php.ini file.
The php.ini file is a configurations file used by PHP to determine configurations. Customers on shared hosting, generally don’t have access to the main file. However, you can still create an empty php.ini in your site’s main directory using an FTP client.
After that simply add this code in your php.ini file:
upload_max_filesize = 100M post_max_size = 100M max_execution_time = 300
That’s all, I hope this article helped you to learn how to upload large images in WordPress. You may also like to see our article on Fatal Error: Maximum Execution Time Exceeded in WordPress.