Nima Tf
Nima Tf

Reputation: 71

Laravel `Storage::put()` not working on Unix server

I want to save my images that modified by image intervention in storage folder in my Laravel project.
Storage::put() this works fine and saves images in storage folder (my local OS is windows 10), but not working in server OS(CentOS 8). storage folder permissions is 755 i've tried 777 but not worked too. Here is my code:

$filename = basename($request->tutorialImage);
$image = Image::make($request->tutorialImage)->resize(300, 400);
$image->stream();
Storage::disk('local')->put('files/shares/resizedImages/' . $filename . '-' . 300 . '-' . 400. '.jpg', $image);

I've already ran command php artisan storage:link too.

Upvotes: 0

Views: 1177

Answers (1)

Hossein Piri
Hossein Piri

Reputation: 832

use this

chown -R $USER:www-data bootstrap/cache
chown -R $USER:www-data storage
chown -R $USER:www-data resources/views
chown -R $USER:www-data public/files

chmod -R 775 storage
chmod -R 775 bootstrap/cache
chmod -R 775 resources/views
chmod -R 775 public/files

Upvotes: 2

Related Questions