Upload base64 image to S3 in Laravel 5.5

Azole (小賴)
1 min readDec 20, 2017

--

list($baseType, $image) = explode(';', $base64);
list(, $image) = explode(',', $image);
$image = base64_decode($image);
$imageName = rand(111111111, 999999999) . '.png';
$p = Storage::disk('s3')->put('filepath/' . $imageName, $image, 'public');

The key point is that you need to give filename specifically.

The adapter can’t get the real path of base64 data. I guess it’s because base64 data is not a file object.

--

--

Azole (小賴)

As a passionate software engineer and dedicated technical instructor, I have a particular fondness for container technologies and AWS.