skip to Main Content

I have a website made with Laravel and recently i have uploaded it on cPanel and now i have some problems;
First problem is that in localhost i can save images in public/images from website and delete them but on cPanel no longer i could upload images.

Second issue is that i have removed all the images in cPanel but still my website loads that old images.When i go to image url directory there is nothing! i don’t know how is it possible.

This is the code i used to save images:

$image = $request->file("image");
    $new_name = "image" . "_" . $lesson->id . "." . $image->getClientOriginalExtension();

    $image->move(public_path('images/lessons'), $new_name);

And the code for show images:

src="{{asset('images/lessons/image_'.$lesson->id.".png")}}"

This is my local folder :

Local folder

Below you can find my public_html folder :

public_html folder

2

Answers


  1. I have a website made with Laravel and recently i have uploaded it on
    cPanel and now i have some problems; First problem is that in
    localhost i can save images in public/images from website and delete
    them but on cPanel no longer i could upload images.

    Could you explain this a little bit more detailed? Thank you.

    Second issue is that i have removed all the images in cPanel but still
    my website loads that old images.When i go to image url directory
    there is nothing! i don’t know how is it possible.

    Sounds like Cache. Have you tried to empty your browser cache after deleting the images on your server? If they are gone, it was the Cache. A cache will/can expire after some amount of time, so that should not be an issue.

    If you want to disable caching while debugging you can turn it off in your developer console. See this answer: Disabling Chrome cache for website development

    I hope this helps.

    Login or Signup to reply.
  2. Try renaming the image, and after you rename, access the link for the renamed image ( using the new name ).

    ie. http://www.xyz.com/image2.png

    And then try delete.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search