mercredi 7 février 2018

Sending image as base64_encoded in json_payload on lumen API

I am sending image as base64_encoded in JSON_PAYLOAD from front-end AJAX request, on the other side I am using LUMEN API to accept that request, get file and store it in db in field having LONGBLOG type, but problem is that when I dump my API method to see the payload sent by front-end it dumps nothing.

my payload is:

{
  data:example_base_64_encoded_file
}

here is api method.

public function upload(Request $request){
    dd(request->data);
}

It gives error that calling the undefined object and when dump only dd($request) it dumps null

CORS are already enabled. I also tried to enable content-type as base_64.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire