. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
| Server IP : 52.223.31.75 / Your IP : 172.31.32.98 [ Web Server : Apache/2.4.66 () OpenSSL/1.0.2k-fips PHP/7.4.33 System : Linux ip-172-31-14-81.eu-central-1.compute.internal 4.14.281-212.502.amzn2.x86_64 #1 SMP Thu May 26 09:52:17 UTC 2022 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE Domains : 4 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /var/www/ripara.co/app/resources/ |
Upload File : |
# Amazon S3 PHP Class
## Usage
OO method (e,g; $s3->getObject(...)):
```php
$s3 = new S3($awsAccessKey, $awsSecretKey);
```
Statically (e,g; S3::getObject(...)):
```php
S3::setAuth($awsAccessKey, $awsSecretKey);
```
### Object Operations
#### Uploading objects
Put an object from a file:
```php
S3::putObject(S3::inputFile($file, false), $bucketName, $uploadName, S3::ACL_PUBLIC_READ)
```
Put an object from a string and set its Content-Type:
```php
S3::putObject($string, $bucketName, $uploadName, S3::ACL_PUBLIC_READ, array(), array('Content-Type' => 'text/plain'))
```
Put an object from a resource (buffer/file size is required - note: the resource will be fclose()'d automatically):
```php
S3::putObject(S3::inputResource(fopen($file, 'rb'), filesize($file)), $bucketName, $uploadName, S3::ACL_PUBLIC_READ)
```
#### Retrieving objects
Get an object:
```php
S3::getObject($bucketName, $uploadName)
```
Save an object to file:
```php
S3::getObject($bucketName, $uploadName, $saveName)
```
Save an object to a resource of any type:
```php
S3::getObject($bucketName, $uploadName, fopen('savefile.txt', 'wb'))
```
#### Copying and deleting objects
Copy an object:
```php
S3::copyObject($srcBucket, $srcName, $bucketName, $saveName, $metaHeaders = array(), $requestHeaders = array())
```
Delete an object:
```php
S3::deleteObject($bucketName, $uploadName)
```
### Bucket Operations
Get a list of buckets:
```php
S3::listBuckets() // Simple bucket list
S3::listBuckets(true) // Detailed bucket list
```
Create a bucket:
```php
S3::putBucket($bucketName)
```
Get the contents of a bucket:
```php
S3::getBucket($bucketName)
```
Delete an empty bucket:
```php
S3::deleteBucket($bucketName)
```