Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

Hello,
I’m receiving the following error whenever I try to upload files to my DigitalOcean Spaces by way of the AWS SDK on PHP.
Fatal error: Uncaught exception ‘Aws\S3\Exception\S3Exception’ with message ‘Error executing “PutObject” on “https://SPACES.sfo2.digitaloceanspaces.com/FILEPATH/FILENAME.EXT”; AWS HTTP error: Client error: PUT https://SPACES.sfo2.digitaloceanspaces.com/FILEPATH/FILENAME.EXT resulted in a 403 Forbidden response: <?xml version=“1.0” encoding=“UTF-8”?><Error><Code>SignatureDoesNotMatch</Code><RequestId>tx000000000000084eb6bea-005e97 (truncated…) SignatureDoesNotMatch (client): - <?xml version=“1.0” encoding=“UTF-8”?><Error><Code>SignatureDoesNotMatch</Code><RequestId>tx000000000000084eb6bea-005e9740a7-443fd0-sfo2a</RequestId><HostId>443fd0-sfo2a-sfo</HostId></Error>’ GuzzleHttp\Exception\ClientException: Client error: PUT https://SPACES.sfo2.digitaloceanspaces.com/FILEPATH/FILENAME.EXT resulted in a 403 Forbidden response: <?xml version=“1.0” encoding=“UTF-8”?><Error><Code>SignatureDoesNotMatch</Code><RequestId>tx000000000000084eb6bea-005e97 (t in /var/www/vhosts/SUBSCRIPTION/DOMAIN/vendor/aws/aws-sdk-php/src/WrappedHttpHandler.php on line 195
Here’s my code:
###spaces_config.php
require '../../vendor/autoload.php';
use Aws\S3\S3Client;
$spaces = new Aws\S3\S3Client([
'version' => 'latest',
'region' => 'us-west',
'endpoint' => 'https://sfo2.digitaloceanspaces.com',
'credentials' => [
'key' => 'SPACES_KEY',
'secret' => 'SPACES_SECERT_KEY',
],
]);
###spaces_UPLOADBLADE.php
$spaces->putObject([
'Bucket' => 'SPACES',
'Key' => 'FILEPATH ON SPACES.$fileKey,
'Body' => fopen($fileTemp, 'r'),
'ContentType' => 'image/'.$fileExtension,
'ACL' => 'private'
]);
###databaseUpload.php file that when form is submitted goes to
$fileFile = $_FILES['fileFile'];
$fileName = $_FILES['fileFile']['name'];
$fileTemp = $_FILES['fileFile']['tmp_name'];
$fileSize = $_FILES['fileFile']['size'];
$fileError = $_FILES['fileFile']['error'];
$fileType = $_FILES['fileFile']['type'];
$fileExplode = explode('.', $fileName);
$fileExtension = strtolower(end($fileExplode));
$thumbnailExtAllow = array('jpg', 'jpeg', 'png', 'pdf');
$thumbnailKey = $postID.".".$fileExtension;
include '../../do_spaces/spaces_config.php';
include '../../do_spaces/spaces_UPLOADBLADE.php';
If anyone is able to help I would greatly appreciate it!
Thanks, DevLexicon
SarkariResultht
KFSys
Arne van Hoorn
alexdo
4287c71658bd4ea39bef277d491b1c
4287c71658bd4ea39bef277d491b1c
Demanix
Demanix
devjk1
Jordan
LC Labs Sp. z o.o.
a0cd9be01b14447384f79073fc121f