Skip to content
Snippets Groups Projects
Commit 9c1a1b9b authored by Jonas Leder's avatar Jonas Leder
Browse files

get static files from S3

parent 0392b78e
No related branches found
No related tags found
1 merge request!1Get files from s3
...@@ -9,4 +9,8 @@ public/js/ ...@@ -9,4 +9,8 @@ public/js/
.sass-cache/ .sass-cache/
#node cache #node cache
node_modules/ node_modules/
\ No newline at end of file
#composer
public/API/vendor
public/API/composer.lock
\ No newline at end of file
{
"require": {
"aws/aws-sdk-php": "^3.181",
"symforge/chilkat-php": "9.5.0.66"
}
}
<?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, '1000 minutes');
// Get the actual presigned-url
echo (string) $presignedRequest->getUri();
\ No newline at end of file
...@@ -14,3 +14,8 @@ $footerMaxPost = 5; ...@@ -14,3 +14,8 @@ $footerMaxPost = 5;
$homeMaxPost = 3; $homeMaxPost = 3;
$trackURL = ""; $trackURL = "";
$S3Server = "";
$S3AccessKey = "";
$S3SecretKey = "";
$S3BucketName = "";
\ No newline at end of file
File deleted
File deleted
File deleted
File deleted
File deleted
File deleted
File deleted
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment