Level 104
The value of multipart is an array of associative arrays, each containing the following key value pairs:
- name: (string, required) the form field name
- contents: (StreamInterface/resource/string, required) The data to use in the form element.
- headers: (array) Optional associative array of custom headers to use with the form element.
- filename: (string) Optional string to send as the filename in the part.
So it should be something more like the following:
$response = $new_client->post( 'https://sometext/profile-update', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer ' . Session::get('SesTok'),
],
'multipart' => [
[
'name' => 'company_logo',
'filename' => $image_org,
'contents' => fopen( $image_path, 'r' ),
],
[
'name' => "first_name",
'contents' => => $request->first_name,
],
[
'name' => "last_name",
'contents' => => $request->last_name,
],
[
'name' => "email",
'contents' => => $request->profile_email,
],
]
]);
1 like
