I cannot upload new images in my website folder but i can still view the old images.

October 1, 2019 158 views
Apache PHP

Hi,

I have my website set up at /var/www/html/public with the images being stored in the /var/www/html/public/images folder. I have run many chown and chmod permissions on this images folder as found online but none of the new images are being able to be viewed even though all permissions are already at 777 and the data owner is www-data.

I can view my old images just fine via domain.com/images/old-image.jpg but domain.com/images/new-image.jpg throws up a blank and when i reference it in my website that image simply does not occur.

This does seem to be a mysterious issue.

Using digitalocean with LAMP installed.

Using Filezilla to transfer my files.

2 Answers

Hi @stanwinsiow,

When you make other changes does your website reflect them?

It sounds to me like you are updating a website that’s not loading from the proper place. Make sure to check the DNS of your domain and see the A record.

Kind regards,
Kalin

  • Hi @KFerdinandov yes when i make changes to the website they are reflecting them. Just the images aren’t loading.

    • Hmm, that’s pretty strange. It does sound like some heavy caching though. Do you have any cache configured?

      • Where do i check the caching? Although i can’t check it right now. I can’t even ping my droplet’s ip at the moment. :(

        • As soon as you can access your droplet, try to restart your Web Server (Apache/Nginx etc.). Then try to load the images and let me know if you can see them.

          Additionally, does accessing domain.com/images/new-image.jpg gives a blank page or a 404 not found error? If it’s a blank page, it’s possible something is stopping it from working, maybe an .htaccess rule?

          Regards,
          Kalin

          • @KFerdinandov so i restored a backup image to my server and voila everything works again. I believed it is as you said an .htaccess rule. I was configuring multiple things and could have messed up a configuration file somewhere. Out of curiosity and side track, do you know how i can track what i changed? P.S new images get load fine now.

Hi @stanwinsiow,

I’m glad to hear you managed to find a solution to the problem.

Regarding your question, the only thing you can do to track changes is using git/gitlab/svn. Personally, I’ll recommend git as git comes with your droplet (if I’m not mistaken!). Here is an article which you can further read on - Article

Regards,
Kalin

Have another answer? Share your knowledge.