example.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. use Symfony\Component\Finder\Finder;
  3. // Include the SDK using the Composer autoloader
  4. date_default_timezone_set('America/Argentina/Buenos_Aires');
  5. require 'vendor/autoload.php';
  6. $s3 = new Aws\S3\S3Client([
  7. 'version' => 'latest',
  8. 'region' => 'sa-east-1',
  9. 'endpoint' => 'https://s3.infra.flowdat.com/minio/login',
  10. 'use_path_style_endpoint' => true,
  11. 'credentials' => [
  12. 'key' => 'iksop',
  13. 'secret' => '8htoiwn44g204th',
  14. ],
  15. ]);
  16. /* Send a PutObject request and get the result object.
  17. $insert = $s3->putObject([
  18. 'Bucket' => 'testbucket',
  19. 'Key' => 'testFer',
  20. 'Body' => 'Hello Fer!!'."\n"
  21. ]);
  22. // Download the contents of the object.
  23. $retrive = $s3->getObject([
  24. 'Bucket' => 'testbucket',
  25. 'Key' => 'testFer',
  26. 'SaveAs' => 'testkey_local'
  27. ]);
  28. */
  29. $directorioA = array('01_login/','02_base/','03_ftth/','04_map/');
  30. for ($i = 0; $i < 4; $i++)
  31. {
  32. $dir = $directorioA[$i];
  33. $directorio = opendir("tests/comp/" . $dir);
  34. while ($archivo = readdir($directorio))
  35. {
  36. if (is_dir($archivo))
  37. {
  38. }
  39. else
  40. {
  41. $result = $s3->putObject(array(
  42. 'Bucket' => 'testbucket',
  43. 'Key' => $dir . $archivo,
  44. 'SourceFile' => '/home/iksop/Escritorio/te/installer/behat/testScreenshot/tests/comp/' . $dir . $archivo
  45. ));
  46. // We can poll the object until it is accessible
  47. $s3->waitUntil('ObjectExists', array(
  48. 'Bucket' => 'testbucket',
  49. 'Key' => $dir . $archivo
  50. ));
  51. }
  52. }
  53. }
  54. // Print the body of the result by indexing into the result object.
  55. //echo $retrive['Body'];