So im currently working on a simple REST API in Laravel. I have a post function which sends entered data to database and uploads one file. Everything works fine on local. Image is uploading to storage/public/my_directory. I also have public access to the uploaded image by going to address "localhost://storage/my_directory/my_file.jpg". The problem is that after deploying the project to shared hosting i cant upload files. Im just getting this meaningless error
Thats how my function looks like:
public function store(Request $request)
{
$request->validate([
'name' => 'required',
'slug' => 'required',
'description' => 'required',
'country' => 'required',
'file' => 'required|image',
'category' => 'required',
]);
$img = $request->file('file')->store('public/images');
$request->merge(['image' => $img]);
$product = Product::create($request->all());
return dd($product);
}
And additionally filesystems.php file:
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
'throw' => false,
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL') . '/storage',
'visibility' => 'public',
'throw' => false,
],
'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'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => false,
],
],
Any suggestions?