mirando
1 Copper

Atmos-PHP for PEER1 CloudOne - Creating, Listing & Uploading/Downloading Files

Hi all,

I'm using PEER1 CloudOne.

I can create an empty file in a PHP script  using the atmos-php framework with this code:


$_files = new EsuRestApi( $host, $port, $uid, $secret );

$file = $_files->createObject( $acl = NULL, $metadata = NULL, $data = 'createObject data',     $mimeType = 'text/plain');

echo 'Empty file created. The file id is '. $file .'';

How do you do this with the uploadHelper class?

Also, anybody know how to list files in the cloud via this framework via REST? I tried the following but got an error 1009.

$_files = new EsuRestApi( $host, $port, $uid, $secret );


try {

$_files->queryObjects('.jpg');

} catch (Exception $e) {
    echo 'Error: ',  $e->getMessage(), "\n";
    echo  'Code: ', $e->getCode(), "\n";
      
}

That code returns:

Error: The method specified in the request is not allowed for the  resource identified. Code: 1009

I don't even think I should post my uploadhelper code as it's obviously wrong...

Thanks!

Labels (2)
0 Kudos
3 Replies
mirando
1 Copper

Re: Atmos-PHP for PEER1 CloudOne - Creating, Listing & Uploading/Downloading Files

I was able to upload a file with the uploadHelper class to PEER 1 CloudOne storage:

<?

$_files = new EsuRestApi( $host, $port, $uid, $secret );
$_upload = new UploadHelper($_files);

$fp = 'test.txt';
$id = $_upload->createObjectFromFile( $fp );
if ($id) {
echo "File $id created";
} else {
echo "File not created";
}

?>

I'm still working out the rest. Hope this helps somebody.

0 Kudos
Highlighted
rbala1
3 Argentium

Re: Atmos-PHP for PEER1 CloudOne - Creating, Listing & Uploading/Downloading Files

Mirando,

Have you seen the unit test included with the wrappers?  The unit test should serve as a guide to implementing each method.


Raj

mirando
1 Copper

Re: Atmos-PHP for PEER1 CloudOne - Creating, Listing & Uploading/Downloading Files

Raj,

Thanks for that information. I wasn't able to run the test as it required PHPUnit, but I see the code now that you mention it. I thought it was part of the framework.

Cheers.

- Luis

0 Kudos