upload image file Hi, can anyone help me with following issue. I am using remote api and I have a form with image file upload, Now the form data are submitted to my server and from there I am hitting remote api with guzzle http client. I am able to send data to remote api using guzzle http client but not the image file.
@maheshbhanushali what kind of error did you get? How do you understand that you are getting wrong? Do you get any error message?
@gregurco Argument 2 passed to GuzzleHttp\Psr7\MultipartStream::addElement() must be of the type array, string given,
$this->client->put('addProducts',
['debug' => true,'verify' => false, 'http_errors' => true,
'multipart' => ['name' => $key, 'contents' => fopen(public_path().'/images/no_image.gif', 'r'),
'headers' => ['accesstoken' => session('instadeliApiToken')]]]);
Try this:
$this->client->put('addProducts', ['debug' => true,'verify' => false, 'http_errors' => true, 'multipart' => [['name' => $key, 'contents' => fopen(public_path().'/images/no_image.gif', 'r'), 'headers' => ['accesstoken' => session('instadeliApiToken')]]}]);
@gregurco that extra square bracket, and ya that header should be out of multipart array and it work like charm :) thanks
Please sign in or create an account to participate in this conversation.