Skip to content
Advertisement

How can I store the images as Blob file in database using laravel 8? [closed]

I want to store my images in database as a blob. not as a file path . How can I do that? I use Laravel .

Advertisement

Answer

This might do the job.

$path = $request->file('file')->getRealPath();    
$logo = file_get_contents($path);
$base64 = base64_encode($logo);
$account->logo = $base64;
$account->save();

Source

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement