27 lines
No EOL
801 B
PHP
27 lines
No EOL
801 B
PHP
<?php
|
|
include("./lib/config.php");
|
|
require 'vendor/autoload.php';
|
|
|
|
$s3Client = new Aws\S3\S3Client([
|
|
'version' => 'latest',
|
|
'region' => 'us-east-1',
|
|
'endpoint' => $S3Server,
|
|
'use_path_style_endpoint' => true,
|
|
'credentials' => [
|
|
'key' => $S3AccessKey,
|
|
'secret' => $S3SecretKey,
|
|
],
|
|
]);
|
|
|
|
// Get a command object from the client
|
|
$command = $s3Client->getCommand('GetObject', [
|
|
'Bucket' => $S3BucketName,
|
|
'Key' => $_GET["filename"]
|
|
]);
|
|
|
|
// Create a pre-signed URL for a request with duration of 10 miniutes
|
|
$presignedRequest = $s3Client->createPresignedRequest($command, '60 minutes');
|
|
|
|
// Get the actual presigned-url
|
|
$downloadURL = (string) $presignedRequest->getUri();
|
|
header("Location: $downloadURL"); |