|
@@ -0,0 +1,55 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+// Include the SDK using the Composer autoloader
|
|
|
+date_default_timezone_set('America/Argentina/Buenos_Aires');
|
|
|
+require 'vendor/autoload.php';
|
|
|
+
|
|
|
+$s3 = new Aws\S3\S3Client([
|
|
|
+ 'version' => 'latest',
|
|
|
+ 'region' => 'sa-east-1',
|
|
|
+ 'endpoint' => 'https://s3.infra.flowdat.com/minio/login',
|
|
|
+ 'use_path_style_endpoint' => true,
|
|
|
+ 'credentials' => [
|
|
|
+ 'key' => 'iksop',
|
|
|
+ 'secret' => '8htoiwn44g204th',
|
|
|
+ ],
|
|
|
+]);
|
|
|
+
|
|
|
+// Send a PutObject request and get the result object.
|
|
|
+$insert = $s3->putObject([
|
|
|
+ 'Bucket' => 'testbucket',
|
|
|
+ 'Key' => 'testFer',
|
|
|
+ 'Body' => 'Hello Fer!!'."\n"
|
|
|
+]);
|
|
|
+
|
|
|
+// Download the contents of the object.
|
|
|
+$retrive = $s3->getObject([
|
|
|
+ 'Bucket' => 'testbucket',
|
|
|
+ 'Key' => 'testFer',
|
|
|
+ 'SaveAs' => 'testkey_local'
|
|
|
+]);
|
|
|
+
|
|
|
+$directorio = opendir("tests/comp/");
|
|
|
+ while ($archivo = readdir($directorio))
|
|
|
+ {
|
|
|
+ if (is_dir($archivo))
|
|
|
+ {
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $result = $s3->putObject(array(
|
|
|
+ 'Bucket' => 'testbucket',
|
|
|
+ 'Key' => 'dir/'.$archivo,
|
|
|
+ 'SourceFile' => '/home/iksop/Escritorio/te/installer/behat/testScreenshot/tests/comp/' . $archivo
|
|
|
+ ));
|
|
|
+
|
|
|
+// We can poll the object until it is accessible
|
|
|
+ $s3->waitUntil('ObjectExists', array(
|
|
|
+ 'Bucket' => 'testbucket',
|
|
|
+ 'Key' => 'dir/'.$archivo
|
|
|
+ ));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+// Print the body of the result by indexing into the result object.
|
|
|
+echo $retrive['Body'];
|