I know this question has been posted several times, but I can't get it.
Now I use :
// photo upload
$dir = strtolower(str_random(2));
$image = $request->file('image')->store('products/'. $dir);
It works perfectly, my file is uploaded to :
storage/app/products/ds/HASH.jpg
But it's not public, I saw the documentation, but I can't understand how to upload to public folder easily.
Can I use the store
function ? I want the same behavior : the filename is hashed, the folder is created on the fly.
I tried :
Storage::setVisibility($image, 'public');
But it doesn't work (no error...).
The doc says to use :
Storage::put('file.jpg', $contents, 'public');
But how can I fill the $content
variable ? How can I have the filename hashed easily ?
php artisan storage:link
to create the public storage symlink? – Jamesking56storage/app/public/
folder, now my images are instorage/app/
folder – Vincent Decaux