Reputation: 143
I've been trying to upload image through the SDK but i get this error:
Fatal error: Uncaught Aws\Glacier\Exception\GlacierException: AWS Error Code: , Status Code: 400, AWS Request ID: , AWS Error Type: client, AWS Error Message: , User-Agent: aws-sdk-php2/2.4.3 Guzzle/3.7.2 curl/7.15.5 PHP/5.3.8 thrown in /www/site/test/Aws/Common/Exception/NamespaceExceptionFactory.php on line 91
And this is my test code:
<?php
// Include the SDK using the Composer autoloader
require 'aws-autoloader.php';
use Aws\Glacier\GlacierClient;
$client = GlacierClient::factory(array(
'key' => 'xxxxxxx',
'secret' => 'xxxxxxxx',
'region' => 'us-east-1' // (e.g., us-west-2)
));
$vaultName = 'http://xxx.xxx.xxx/vrs/images/album/default/pp.jpg';
$filename = '/www/site/test/pp.jpg';
$result = $client->uploadArchive(array(
'vaultName' => $vaultName,
'body' => fopen($filename, 'r'),
));
$archiveId = $result->get('archiveId');
var_dump($archiveId);
Any help is greatly appreciated :)
Upvotes: 2
Views: 627
Reputation: 6527
It seems you may be confused about the difference between vaults and archives. You should make sure to look through the Amazon Glacier Developer Guide to become familiar with the basic concepts of Glacier. You must first create a vault in order to upload archives to it. A vault in Glacier is similar to a bucket in S3.
You should also check out these links which provide code samples for doing uploads with Glacier:
Upvotes: 1