protected function Client::uploadPresigned in Media: Acquia DAM 8
Uploads file to Webdam AWS S3.
Parameters
mixed $presignedUrl: The presigned URL we got in previous step from AWS.
string $file_uri: The file URI.
string $file_type: The File Content Type.
Return value
array Response Status 100 / 200
Throws
\GuzzleHttp\Exception\GuzzleException
\cweagans\webdam\Exception\InvalidCredentialsException
File
- src/
Client.php, line 255
Class
- Client
- Overridden implementation of the cweagans php-webdam-client.
Namespace
Drupal\media_acquiadamCode
protected function uploadPresigned($presignedUrl, $file_uri, $file_type) {
$this
->checkAuth();
$file = fopen($file_uri, 'r');
$response = $this->client
->request("PUT", $presignedUrl, [
'headers' => [
'Content-Type' => $file_type,
],
'body' => stream_get_contents($file),
RequestOptions::TIMEOUT => 0,
]);
return [
'status' => json_decode($response
->getStatusCode(), TRUE),
];
}