|
Resources
Sample Code and Libraries
Amazon S3 Sample in PHP
Posts:
2
Registered:
2/4/08
|
|
|
|
getObject for private files with PHP
Posted:
Jan 6, 2009 8:21 AM PST
|
|
|
Hey guys. I’ve got a problem. I read in other comments about makingthe file private and wanting to control access to the file whendownloading. I don’t want to do the temp url thing, I’m not sure ifthat is secure enough (maybe it is, if so I’d like to know why
) butinstead, I’d like to use the getObject method to grab the fileinformation and put that into somesort of php file object and then dothe file output where you create the File headers, then do a“readfile($filename);” and it send it to the browser.
Icould potentially just save the file down to the hard disk, and serverit up, then delete it once it’s been downloaded, but that may proveinefficient. I’d like to just have it load in memory, never touch thehard disk, and load right into a php file object and then pump that outto the page (espically for images etc.)
Any thoughts? I’dlike to use the direct link to the file on amazon, i just want to makesure i can control access to the file.
Thanks in advance!
Message was edited by: Travis M. Cooper
|
|
Posts:
1
Registered:
2/10/09
|
|
|
|
Re: getObject for private files with PHP
Posted:
Feb 10, 2009 10:17 AM PST
in response to: Travis M. Cooper
|
|
|
Did you ever find an efficient and quick way to do this? I'd love to see what you put together if at all possible. Thanks!
|
|
|
|
Looks simple, but.., Nov 29, 2007 9:07 PM
Reviewer: Darrell Silver
Looks simple, but I'm stuck on super beginner stuff. I get the error "AWS authentication requires a valid Date or x-amz-date header"
|
|
s3.class.php to support EU, Jan 8, 2008 6:07 AM
Reviewer: thommyfilm
hello!
did you already modify s3.class.php to support the EU.
have a look at this:
http://docs.amazonwebservices.com/AmazonS3/2006-03-01/RESTBucketPUT.html
would be cool to set this parameter using s3.class.php.
can you help?
greetings
t.
|
|
Ok, but needs to be updated., Nov 21, 2008 3:10 PM
Reviewer: johndubya28
Looks pretty good, but it definitely needs some updating and cleaning up. Worst thing is that this script still uses $_REQUEST, which needs to be either GET or POST. Otherwise, it should do the trick.
|
|
1 bug that ruins GETs!, Nov 21, 2008 5:13 PM
Reviewer: grig bilham
Folks - i spent days on this and other code examples. This is the one to use, but there's a bug that will kill the GET and drive you nuts!
Add this line:
if ($verb != "PUT") $contentType="";
before you assemble the $stringToSign string.
$stringToSign = "$verb\n\n$contentType\n$httpDate\nx-amz-acl:$acl\n/$resource";
BTW: PHP4 users - this will work for you too!
You're welcome! ;)
|
|
Unable to run the sample, Oct 5, 2009 10:29 PM
Reviewer: seveorkay
I am unable to run the sample PHP code. I get the below error. believe the crypt/HMAC is deprecated and the new one is Crypt/HMAC2. I did install the package, but it still gives the same error. Running php 5.2.9:
Warning: require_once(Crypt/HMAC.php) [function.require-once]: failed to open stream: No such file or directory in C:\xampp\htdocs\s3.php on line 32
Fatal error: require_once() [function.require]: Failed opening required 'Crypt/HMAC.php' (include_path='.;C:\xampp\php\pear\') in C:\xampp\htdocs\s3.php on line 32
|
|
|
|
 |
|
|