How to Fix Image Upload Issue in WordPress

Recently, my website has some issues with the database so decided to completely reinstall WordPress. After backing up the database, installed a new version of WordPress completely. Everything went right except of course in WordPress media library images uploaded but it never shows, only ghost part of images is shown in the media segment of WordPress. This means that there are some media issues with WordPress as well as in hosting server. There are way around to show images on site but that is too much time taking and as this site deals with plenty of info-graphics many a time it is simply not possible to upload images to hosting and then retrieve the link and then paste it in ‘insert from URL’ media library of WordPress. When uploading via media library of WordPress, it goes on to show, weird images and only ghost images and the real images are not shown. This problem occurs when a new WordPress installation is done or some updates of WordPress are applied. From WordPress media library side, it is easier to upload images. This article is all about how to fix the image upload issue in WordPress. I have searched the internet for this but no webmaster have given a sufficient answer to this. This is entirely an original article and I hope this would help immensely to webmasters who are facing similar issues right there within.

Change file permission of upload directory:

Sometimes, your host after scheduled maintenance used to change file permissions of some of hosting files and for this it is essential to check currently what is file permission of yours media upload directory. Sometimes, due to backdoor hack or advent of Trojan in host can cause automatic file permission change and for this it is essential to check this out also. As I have mentioned above many a time, after reinstallation or up gradation of WordPress, file permission changes automatically. Here are steps to check file permission of media upload directory. Media upload directory, is the folder which resides inside web host and store all images in according with months and years.

  1. Login host panel, from ‘files’ directory right click on ‘File Manager’ and left click on ‘Open Link in new tab’
  2. Now ‘File Manager’ window, go to ‘public_html’ .
  3. Double click on ‘wp-content’ on the right hand side of ‘public_html’to reach to ‘uploads’. This is the default image storing place as well as the temporary folder to store core update files.
  4. Right click on ‘uploads’ then left click on ‘Change Permissions’
  1. A new popup window namely ‘Change Permissions’ appears and from there set ‘Permission’ to 755 as per screen-shot. Users should have to right to read, write and execute while as group and world should have the right to read and execute.
  2. Then click on ‘Change Permissions’ at the bottom to save the setting.

Fixing auto upgrade issues with WordPress:

Whenever image upload issues arrive so on there are issues relating to fix to auto upgrade of plugins and WordPress. In order to get a seamless integration of images inside media library of WordPress the second part of repairing hosing files should be fixing upgrade issues with WordPress and it is done as most of temporary files before upgrade stays inside image upload file of host. Here is the way to fix failed update installation of WordPress as well as plugins.

  1. Make sure ‘wp-inlcude’ and ‘wp-content’ directory set to 755 permission. Refer screen shot.
  2. To do this repeat steps 1 and 2 of Change file permission of upload directory
  3. Now you reach at ‘File Manager’ and select ‘public_html’ on left side and you will find ‘wp-content’ and ‘wp-include’ on right-hand side.
  4. Right click on ‘wp-content’ and left click on ‘Change Permissions’
  5. A new popup window namely ‘Change Permissions’ will show up.
  6. In ‘Permissions’ write it 755. Then click on ‘Change Permissions’ at the bottom to save setting.
  7. .Follow points of 3,4,5,6 to give ‘Permissions’ of ‘wp-content’ to 755. Refer screen shot

Editing wp-config.php

  1. Follow points 1 and 2 of ‘Change file permission of upload directory’ to reach to ‘File Manager’
  2. Reach to its right hand side and scroll down to find ‘wp-config.php’
  3. Double click on its icon to back it up this file to a local directory.
  4. Then single click on ‘wp-config.php’ and click on ‘Code Editor’ on the main menu of ‘File Manager’. Refer screen shot for details.
  5. A new popup window namely ‘Code Editor’ opens and from there left click on ‘Edit’
  6. A new window namely ‘wp-config.php’ in an editable form will open in a new tab.
  7. Add this line to the bottom of your “wp-config.php” file:

define(‘WP_TEMP_DIR’,ABSPATH.’wp-content/uploads/’);

Then, click ‘Save Changes’ from the right hand side of the top menu of ‘wp-config.php’ file. This line will result in WordPress to use “/wp-content/uploads” folder to store temporary files and it prevents storing temporary files in the system-wide /tmp folder. When, WordPress save temporary files there, it causes prevention of execution of such files. In this way both image upload fix as well as failure of the auto upgrade of WordPress installation and plugins installation is fixed.

Final step: adding media directory root to WordPress media settings:

After completing all these aforementioned steps, the final step is to log in to WordPress and then adjusting or informing WordPress for exact root of the upload directory. This step is important and needs to be done after all these steps in order to fix the image upload issue and failure of auto-upgrade of WordPress installation as well as plugin installations.

  1. Login to WordPress. Put username and password and click on ‘Login’
  2. From ‘dashboard’ of ‘WordPress’ reach to ‘Settings’
  3. From ‘Settings’ reach to ‘Media’
  4. Left click on ‘Media’ and in ‘Uploading Files’ tick on ‘Organize my uploads into month-and year-based folders’
  5. Then in upload directory puts ‘’ wp-content/uploads” and leaves second one blank. Do not put http://yoursite.com/wp-content/uploads . It will show errors. It is advisable to only put ‘wp-content/uploads’

Summary:

This will definitely fix image upload issue and resolved auto upgrade of WordPress and plugins. In this writes up we have given sufficient privileges to various directories, then add code to wp-config.php and then login to WordPress and then to the media folder and direct the upload directory in the media folder. When these issues crop up you will find the path of the media directory inside the media folder of WordPress is visible and this goes on to show, there is possible problem with this. When finally, you have applied path such as ‘wp-content/uploads’ to paths of media directory and then save changes, then log out of WordPress Dashboard. Then log into WordPress dashboard after a few seconds and reach to the media folder to find that the root directory of media folder is not visible and this signifies that you have fixed the image upload issue and solved auto upgrade of WordPress installation and plugin installation.

Remember after inserting codes inside wp-config.php, the issue of auto up gradation of WordPress and updating plugins straight from WordPress is completely solved. But you have to then follow, adding media directory route to WordPress media settings as above in order to fix the image upload issue. Now go back to the WordPress admin area and try uploading images again to find that images are now completely uploaded to your host from the admin area of WordPress. This issue has been completely unknown to most webmasters and I am sure and glad to inform that this issue is now completely solved and let others know everything about it and help them correct such errors completely. Have a great day…!

10 responses on “How to Fix Image Upload Issue in WordPress

  1. Buildings on Mercury

    I massively like your lesson here. I realize you have worked tirelessly on it like a master of the area. You really are a terrific writer and your lesson very much should get more visits.

Leave a Reply

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

Popular Posts