0
I am receiving a several images in Base64 format. I only receive the string. How do I decrypt and save on Laravel 8’s Torage? I’m doing it like this but it makes a mistake:
$image1 = $data['lstItensOS'][1]['foto1a'];
//return $image1;
$decoded=base64_decode($image1);
$data['image'] = $decoded->store("rfs/ordenslocal/{$numOs}/fotos");
Error:
"message": "Call to a Member Function store() on string",
"Exception": "Error",
base64_decode is not a class that has methods ( store in case). Have a look at doc. https://laravel.com/docs/8.x/filesystem#file-uploads.
– Marcos Xavier
I understood the comment but still not understood how to solve. I would have an example?
– Marcos Birro
https://gist.github.com/oliveiraxavier/90668c738c2766069a73804a3082a642 Here is a simple example. The files will be in Storage/app/images. Don’t forget to run php Artisan Storage:link. I didn’t create validation rules to check if the uploaded file is allowed. Check the documentation https://laravel.com/docs/8.x/validation#Rule-mimes or right here on Sopt
– Marcos Xavier
Okay. Settled Thank you.
– Marcos Birro