Home > Enterprise >  I don't understand why laravel saves an image locally but not remotely?
I don't understand why laravel saves an image locally but not remotely?

Time:04-09

I am trying to save images in /public/storage/photos. Until now everything worked locally but I switched to production on my remote machine and I can't create the photo in my folder but I store its name in my sql table. I first thought it was a problem related to the right but it's not that (I did a chmod 777 to be sure). So I really don't see where it comes from, any idea?

$validated = $this->validate([
'photo' => 'image|max:2048',
]);
$name = $id.'_'.md5($mission->name).'id_1'.'.'.$this->photo->extension();
$this->photo->storeAs('photos', $name, 'public');

CodePudding user response:

In your .env file, do you have FILESYSTEM_DRIVER set to something other than "local"?

CodePudding user response:

it seems that your code works, please run & check

php artisan storage:link 
  • Related