jeudi 18 octobre 2018

How to store file from memory to a storage in Laravel5?

I have a variable, which holds an image as a base64 string. How is it possible to put that file to a storage? I tried this:

\Illuminate\Support\Facades\Storage::disk($disk_name)->putFileAs($dir_path, base64_decode($image_str), $file_name);

Unfortunately I get this error: Call to a member function getRealPath() on string

The reason is, that the second parameter of the putFile function should be an Illuminate\Http\File object, but I have no idea how to create one from a base64 string.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire