Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ramikatz's avatar

I deployed my laravel site to Namecheap shared host. but no Images.

I deployed my laravel site to Namecheap shared host. existing images are working and previewing well.

but if I add an image using my one of CRUD, it only generates an image name. (245682104.jpg) I can see that image name on my database. but no preview on the dashboard. and No saved image on public_html/upload/firmware

But in the local host are fine and working wel. can you help me?

my htaccess file

Options -MultiViews -Indexes
RewriteEngine On

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

This is my index file

0 likes
5 replies
mcangueiro's avatar

I'm guessing your images are being uploaded to your storage folder and you haven't symlinked it to the public folder in your production server.

Check to see if the images are in your storage folder and report back.

Ramikatz's avatar

I checked there,but I can't found images. I use this method to store images

    if ($request->file('image')) {
        File::delete('upload/firmware' . $firmdownpost->image);
        $image = $request->file('image');
        $my_image = rand() . '.' . $image->getClientOriginalExtension();
        $image->move(public_path('upload/firmware'), $my_image);
        $firmdownpost->image = $my_image;
    }
mcangueiro's avatar

Are you sure that code works on localhost? I don't see you storing the image anywhere there. I see you are trying to move a file, but don't see where you are uploading the file.

Ramikatz's avatar

​``` if ($request->file('image')) { File::delete('upload/firmware' . $firmdownpost->image); $image = $request->file('image'); $my_image = rand() . '.' . $image->getClientOriginalExtension(); $image->move(public_path('upload/firmware'), $my_image); }

$firmdownpost = new() Firmdownpost(); $firmdownpost->image = $my_image; $firmdownpost->save(); ​```

In the localhost, It works fine. I move the image to public/upload/firmware. and renamed it and save that name in the database. and display using

<img src="{{url('upload/firmware',$firmdownpost->image)}}"> ​

sry, I am new to Laravel, please tell me if there is any other way to save image.

Please or to participate in this conversation.