Laravel: Save Base64 .png file to public folder from controller

后端 未结 8 1736
灰色年华
灰色年华 2021-02-05 07:46

I send a png image file to controller in base64 via Ajax. I\'ve already test and sure that controller has received id but still can\'t save it to public folder.

8条回答
  •  一生所求
    2021-02-05 08:06

    I'v done it!!

    I replaced $data->base64_image to $_POST['base64_image'] and then use $result = file_put_contents($path, $image); instead of Image::make($image->getRealPath())->save($path);

    But this doesn't look like a laravel ways. I you have another way that look more elegant please tell me!

提交回复
热议问题