Base64 encode image uploading Is this a correct way to upload base64 encoded image using Guzzle client?
$response = $this->client->post($uriBase,[
'multipart' => [
'name' => 'image',
'contents' => ['image'=>$base64]
]
]);
If the image is base64 encoded already, then why multipart at all?
@tykus I am using face recognition and I need to pass base 64 encoded image
$path ='https://upload.wikimedia.org/wikipedia/commons/3/37/Dagestani_man_and_woman.jpg';
$type = pathinfo($path, PATHINFO_EXTENSION);
$data = file_get_contents($path);
$base64 = 'data:image/' . 'jpg' . ';base64,' . base64_encode($data);
$response = $this->client->post($uriBase,[
'headers'=>['Authorization' => 'Bearer '. $request->token],
'form_params'=>['image' => $base64]
]);
But that is throwing exception of 400 Bad Request
So I tried to upload image using multipart
Let me know what would be the best way to solve that exception
I am using this API documentation https://developer.bioid.com/bwsreference/web-api/web-upload-api
Please sign in or create an account to participate in this conversation.