When i try to upload an image to my site, it stores in my storage folder, however, the symlink does not work so it doesnt save it in my public_html folder. I have tried using a custom symlink php file however it does not seem to do anything.
My symlinkcreate.php file
<?php
symlink('/home/jackdeaz/nscraft/storage/app/public', '/home/jackdeaz/public_html/storage');
my Filesystems.php file
'default' => env('FILESYSTEM_DRIVER', 'local'),
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
],
],
This is how i upload an image
$request->file('image_url')->store('public/img/products');
Any help would be greatly appreciated!
2
Answers
As explained by @MorganTouvereyQuilling here:
This might definitely be a permissions issue. What permissions are being used by your (a) web server (e.g.
nginx
), PHP process manager (php-fpm
). Ideally, these should be the same, and the director/ies they’re trying to store files in should have at least the same group permissions (e.g. 775).