proxy files instead of redirecting
This commit is contained in:
parent
10741033d5
commit
97f49d44ee
1 changed files with 12 additions and 1 deletions
|
@ -24,4 +24,15 @@ $presignedRequest = $s3Client->createPresignedRequest($command, '60 minutes');
|
|||
|
||||
// Get the actual presigned-url
|
||||
$downloadURL = (string) $presignedRequest->getUri();
|
||||
header("Location: $downloadURL");
|
||||
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_URL, $downloadURL);
|
||||
curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt ($curl, CURLOPT_CONNECTTIMEOUT, 20);
|
||||
curl_setopt ($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
|
||||
curl_setopt ($curl, CURLOPT_FOLLOWLOCATION, true);
|
||||
|
||||
$content = curl_exec ($curl);
|
||||
$contentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE);
|
||||
header('Content-Type: ' . $contentType);
|
||||
echo($content);
|
Loading…
Reference in a new issue