by
8,522 33
1
5
3,538
1
Top 1% !
Popular
Famous
Specified
OpenSource
Popularity: 2789th place
Created
Modified Jul 23, 2013

Published on:

No tags for this snippet yet.
Extension.php
LanguagePHP
LicenseMIT_X11
Target Frameworkaws

Amazon AWS - PHP: Generate public download URL

This snippet demonstrates how to generate a public download URL for a file stored in your S3 Bucket.
Target file must have ACL public permissions set.
In order to use this service you must enable Amazon Simple Storage Service (Amazon S3) in your account.
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/5855/Amazon-AWS---PHP--Generate-public-downlo?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
<?php require_once('sdk.class.php'); $s3 = new AmazonS3(); $fileName = 'LighthouseNew.jpg'; $bucketName = 'myBucketName'; $url = $s3->get_object_url($bucketName, $fileName); echo("Download url: <a href=\"$url\">$url</a>\n"); ?>
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus