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

nikhilverma's avatar

Image not storing in public folder after deploying in server

I have deployed Laravel to hosting and changed the .env file and .htaccess file iam facing problem I want to store image in public folder but it is not uploading. in localhost it is working perfectly.

// store featured image $filename = uniqid() .'.'. $extFeatured; @copy($featredImg, 'assets/front/img/product/featured/' . $filename); - in this path $in['feature_image'] = $filename;

0 likes
13 replies
axeloz's avatar

You should try to find what the error is.

axeloz's avatar

There should be. Or else the upload works. Maybe it goes in a different folder, somewhere you are not looking for. Are you catching errors?

nikhilverma's avatar

@axeloz it is working on localhost but in hosting it is not working. I think it is not getting targeted path I tried soo hard but nothing is working

1 like
axeloz's avatar

@nikhilverma then you must debug in PROD. Use try...catch, and send errors somewhere. Personally I use Sentry.io

Dunsti's avatar

Check your settings in .env-file ( FILESYSTEM_DRIVER ) and in /config/filesystem

It could also be, that you need to clear the config on your live-system: php artisan config:clear

oraclec's avatar

I have same problem but still no solution

1 like
Snapey's avatar

@oraclec Your problem is likely different. Start your own question and detail what you have tried.

BurtDS's avatar

Did you link your Storage folder in production? php artisan storage:link

Please or to participate in this conversation.