A few days ago, one of our readers noticed a strange error in the WordPress media library. Whenever she tried to open the media library, she saw broken images.
Did you ever experience any broken image error? You don't see images on your website because WordPress doesn't fetch them from its media library.
The big problem occurs when you have no idea about WordPress directories and where all the images are present on your web hosting server.
Before anything, you should understand the cause of an error related to image upload. When you don't have proper file and folder permissions, you can't accomplish any task in your WordPress media library.
In this tutorial, you're going to learn the easiest way to fix this issue using FTP. I hope you know how to connect an FTP server using Filezilla.
Before you start, you should make sure; you already have an FTP account. Let me tell you that there is an alternative to fix this issue. You can use cPanel of your web hosting account.
Check File and Folder Permissions
As I have already mentioned, you can connect to your FTP account using Filezilla, which is a free software to download.
You need to make a connection between Filezilla and your web hosting server using your FTP account. To do so, you require a few things.
- Host (ftp.yoursite.com)
Many web hosting companies offer their custom host, username, and password. You have to check your FTP account credentials.
But in most of the cases, you can connect Filezilla to your web hosting server using the conventional host(ftp.yoursite.com), username and password are as same as of the cPanel login credentials, 21 is the port you should use.
Many companies allow you to use the default port, in such case, you don't need to fill 21 in the port field.
Let me start the process.
Once you fill all the details, click Quickconnect and the connection gets established.
You can see your website data under Remote Site. You can easily see the public_html directory, and the content available in it is shown in the box below.
You need to open the wp-content folder.
Now, you can see many files and folder present in the wp-content folder. As you know, whenever you upload any media file to your WordPress media library, it gets uploaded to the /uploads/ folder.
So, you need to check the file and folder permissions to /uploads/, to do so, right-click and choose File Permissions.
You need to make sure that the file permission is 744 or 755. You can change them by knowing a little bit more about how permissions are set.
You can see three different boxes for each type of user, try checking and unchecking to see the magic.
Let me show you how this works.
- Read = 4
- Write = 2
- Execute = 1
You have to calculate the number for each user.
- An owner can read, write, and execute, which means the final number is 4+2+1(read+write_execute) = 7.
- A group can only read, so it's = 4
- The public can just read, so it's = 4
If you combinate all the numbers, the file permission becomes 744.
You're not done yet, to finish it, you need to check the box for Recurse into Subdirectories and choose the radio button for Apply to directoriesonly, click Ok.
You have successfully set the file permissions for the directories.
Note: If 744 doesn't work, you should make it 755 by allowing the group and public to execute.
You have set the permissions just for directories, to apply the correct permissions for files, you should change it to 644.
Right-click to the uploads folder, choose File Permissions.
As I have already explained, how the permissions work and how you can set the different permissions. Set them to 644.
Don't forget the checkbox to Recurse into Subdirectories and a radio button "Apply to files only." Click ok, and everything goes perfectly.
You can check your website by reloading it. It would be great if you clear the browser cache and cookies, too.
If everything works fine, congrats, you have learned to fix the image upload issue for your website. Most of the people freak out when they see the broken images; they may also think if it's happening because of the poor internet connection.
Well, you know what do know.
I Hope it's not So Difficult as You Thought
Every time I try something new, I make sure my readers get a glimpse of it. Using Filezilla to connect with your web hosting server can save so much time.
I know sometimes, cPanel can be scary because of all those options, but FTP is there for you to accomplish such small tasks within a few minutes.
The broken images in your media library can be critical if you don't fix the issue. It's because WordPress takes every possible step to check the authenticity and if your file and folder permissions are wrong, it denies your access to images.
So, it's better to learn something new and fix the problem.