Is it possible to post a blob using Guzzle? The only methods I've been able to find are using @filename to upload a local file. The file is stored as a blob in a MySQL database and I would like to upload it to an api as a post field without the redundancy of saving the blob to disk (and the permissions/path issues that come with it), uploading @filename, and then unlinking the file. Here is the code I have that is working for everything but the blob. I need the 'file' field to save the data as a blob.
$data = array(
'first_name' => $fname,
'last_name' => $lname,
'email' => $email,
'partner_key' => 'qwerty',
'secret_key' => 'qwerty',
'file' => $fileblob
);
$curl = new \GuzzleHttp\Client();
return $curl->post('https://www.api.com',['verify'=>false,'body'=>$data])
The goal being to replace the existing cURL code using Guzzle:
'file' => "@".$localfile.";type=".mime_content_type($localfile)
I found the solution. Hopefully this helps others in the future: