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 infographics 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.
- Login host panel, from ‘files’ directory right click on ‘File Manager’ and left click on ‘Open Link in new tab’
- Now ‘File Manager’ window, go to ‘public_html’ .
- 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.
- Right click on ‘uploads’ then left click on ‘Change Permissions’
- 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.
- 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.
- Make sure ‘wp-inlcude’ and ‘wp-content’ directory set to 755 permission. Refer screen shot.
- To do this repeat steps 1 and 2 of Change file permission of upload directory
- 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.
- Right click on ‘wp-content’ and left click on ‘Change Permissions’
- A new popup window namely ‘Change Permissions’ will show up.
- In ‘Permissions’ write it 755. Then click on ‘Change Permissions’ at the bottom to save setting.
- .Follow points of 3,4,5,6 to give ‘Permissions’ of ‘wp-content’ to 755. Refer screen shot
- Follow points 1 and 2 of ‘Change file permission of upload directory’ to reach to ‘File Manager’
- Reach to its right hand side and scroll down to find ‘wp-config.php’
- Double click on its icon to back it up this file to a local directory.
- Then single click on ‘wp-config.php’ and click on ‘Code Editor’ on the main menu of ‘File Manager’. Refer screen shot for details.
- A new popup window namely ‘Code Editor’ opens and from there left click on ‘Edit’
- A new window namely ‘wp-config.php’ in an editable form will open in a new tab.
- Add this line to the bottom of your “wp-config.php” file:
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.
- Login to WordPress. Put username and password and click on ‘Login’
- From ‘dashboard’ of ‘WordPress’ reach to ‘Settings’
- From ‘Settings’ reach to ‘Media’
- Left click on ‘Media’ and in ‘Uploading Files’ tick on ‘Organize my uploads into month-and year-based folders’
- 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’
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…!