I need to save the image which was converted using base64 to the storage directory instead of saving it inside the public
folder,
Here is my store function which saves the image into my public
directory,
public function store(Request $request, Category $category)
{
if ($request->image) {
$name = time().'.'. explode('/', explode(':',substr($request->image, 0, strpos($request->image, ';')))[1])[1];
Image::make($request->image)->save(public_path('img/category/').$name);
return response('success');
}
I need to know how i can save the images into my storage folder,
As described in the Laravel 8 official documentation , on my local laravel installation, I have imported the following:
use Illuminate\Support\Facades\Storage;
And then in the store method:
Storage::disk('local')->put(time() . '.' . 'example.txt', 'Contents');
It stores the file into storage/app and not into the public directory.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.