project is on macOS sonoma.
want to store image from webcam project https://www.itsolutionstuff.com/post/laravel-webcam-capture-image-and-save-from-camera-exampleexample.html (worked on standalone project)
next i want store string into db and store image on new file project this is code i currently use:
`use Illuminate\Support\Facades\Storage;`
also i’ve been trying using
`use Storage`
and this is code inside the function
//Image
$img=$request->image;
$folderPath=('upload/');
$image_parts=explode(";base64",$img);
$image_type_aux= explode("image/", $image_parts[0]);
$image_type=$image_type_aux[1];
$image_base64 = base64_decode($image_parts[1]);
$fileName=$request->image.'.png';
$file=$folderPath.$fileName;
Storage::put($file,$image_base64);
//String
Product::create($request->all());
return redirect()->route('products.index')->with('Success','Product created successfuly’);
here’s config filesystem
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
'throw' => false,
'permissions' => [
'file' => [
'public' => 0644,
'private' => 0600,
],
'dir' => [
'public' => 0755,
'private' => 0700,
],
],
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
'throw' => false,
'permissions' => [
'file' => [
'public' => 0644,
'private' => 0600,
],
'dir' => [
'public' => 0755,
'private' => 0700,
],
],
],
But in the end, it return error: League\Flysystem\UnableToCreateDirectory
"Unable to create a directory at /[directory_name]”
been trying change root access and it didn’t work. image upload into storage locally