get.php 698 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. use Aws\S3\S3Client;
  3. use League\Flysystem\AwsS3v3\AwsS3Adapter;
  4. use League\Flysystem\Filesystem;
  5. include __DIR__ . '/vendor/autoload.php';
  6. $client = new S3Client([
  7. 'credentials' => [
  8. 'key' => 'iksop',
  9. 'secret' => '8htoiwn44g204th' ],
  10. 'endpoint' => 'https://s3.infra.flowdat.com/minio/login',
  11. 'use_path_style_endpoint' => true,
  12. 'region' => 'sa-east-1',
  13. 'version' => 'latest',]);
  14. $adapter = new AwsS3Adapter($client, 'comparaciones');
  15. $filesystem = new Filesystem($adapter);
  16. $path = $_GET["path"];
  17. if($filesystem->has($path)){
  18. header("Content-type:". $filesystem->getMimetype($path));
  19. $strm = $filesystem->readStream($path);
  20. echo stream_get_contents($strm);
  21. }