views:

217

answers:

1

Hello,

I'm currently using the Amazon S3 PHP Class, getObjectInfo()

The line I'm using is this:

  $info = $s3->getObjectInfo($bucketName, baseName($uploadFile));
 echo "S3::getObjecInfo(): Info for {$bucketName}/".baseName($uploadFile).': '.print_r($info, 1);

And it returns something like this:

  S3::getObjecInfo(): Info for media/7743247696.mp4: Array ( [time] => 1254199603 [hash] => 99a974c6fe806f63ab7994708ea8484b [type] => video/mp4 [size] => 4562654 )

Using PHP, how can I extract one bit at a time, more specifically, to get the [size] attribute so that I can add this to my database?

+1  A: 

Looks like this is just an associative array. You can access elements using $arrayName['keyName']:

$info = $s3->getObjectInfo($bucketName, baseName($uploadFile));
$size = $info['size'];

echo "Size: $size";
pix0r
Easier than I thought. Never dealt with an associative array. Thanks!
Dodinas