Paperclip - Amazon S3 - https

I am able to use Paperclip to save files to Amazon's S3 storage. Once saved, the files are available using a URL associated with the bucket and filename.

I have not been able to find a good tutorial which clearly explains how to save a file to S3 (using Paperclip) whereby it can only be retrieved using https, and only for a limited time period (which I understand is a function of S3).

My specific need is to upload the file from one web page, while allowing a user (who has logged into the site) to then (for a limited amount of time) to access that page using https and a link on a page served to that user.

Does anyone have good tutorial or example code which addresses this issue?

Take a look at:

http://scottmotte.com/archives/181.html

Regards, Daniel Gaytán

Daniel,

While I'm sure that you had good intentions, the tutorial to which you referred is absolutely unrelated to the question I asked.

Specifically, I clearly stated that I know how to use Paperclip to upload files to S3, and to create a url to retrieve the files. My question was whether anyone knew of a tutorial relating to https, as I am interested in being able to control access to the uploadeed files.

In the future, may I suggest that no answer is better than a wrong answer or guess, which simply makes others, who may know the answer, refrain from looking at the question.

Sandy

Please don't top post, it makes it difficult to follow the thread. Insert your reply at appropriate points in the previous mail. Thanks.

Daniel,

While I'm sure that you had good intentions, the tutorial to which you referred is absolutely unrelated to the question I asked.

Specifically, I clearly stated that I know how to use Paperclip to upload files to S3, and to create a url to retrieve the files. My question was whether anyone knew of a tutorial relating to https, as I am interested in being able to control access to the uploadeed files.

In the future, may I suggest that no answer is better than a wrong answer or guess, which simply makes others, who may know the answer, refrain from looking at the question.

I don't think that getting shirty with those trying to help is likely to get you anywhere. Often those reading mail only have time to skim messages and may make suggestions that they think may be helpful, but may not turn out to be so. You might to better by gracefully pointing out that the suggestion does not help and ask for further suggestions.

Colin

Please don't top post, it makes it difficult to follow the thread. Insert your reply at appropriate points in the previous mail. Thanks.

> Daniel,

> While I'm sure that you had good intentions, the tutorial to which you > referred is absolutely unrelated to the question I asked.

> Specifically, I clearly stated that I know how to use Paperclip to > upload files to S3, and to create a url to retrieve the files. My > question was whether anyone knew of a tutorial relating to https, as I > am interested in being able to control access to the uploadeed files.

> In the future, may I suggest that no answer is better than a wrong > answer or guess, which simply makes others, who may know the answer, > refrain from looking at the question.

I don't think that getting shirty with those trying to help is likely to get you anywhere. Often those reading mail only have time to skim messages and may make suggestions that they think may be helpful, but may not turn out to be so. You might to better by gracefully pointing out that the suggestion does not help and ask for further suggestions.

He started off by saying the poster had good intentions. I don't see the problem. You on the other hand has done nothing but to gripe and lecture at everything OP has done.

Sandy wrote:

My specific need is to upload the file from one web page, while allowing a user (who has logged into the site) to then (for a limited amount of time) to access that page using https and a link on a page served to that user.

Does anyone have good tutorial or example code which addresses this issue?

I haven't seen a tutorial for it, but you may want to take a look at the docs for aws-s3 here: http://amazon.rubyforge.org/

Take a look at the section "Accessing private objects from a browser", which goes into detail about SSL and link expiration. Paperclip also provides options for these settings, take a look at the docs for the S3 module: http://rdoc.info/projects/thoughtbot/paperclip

Excerpt:

s3_permissions: This is a String that should be one of the “canned” access policies that S3 provides (more information can be found here: docs.amazonwebservices.com/AmazonS3/2006-03-01/RESTAccessPolicy.html#RESTCannedAccessPolicies) The default for Paperclip is :public_read.

s3_protocol: The protocol for the URLs generated to your S3 assets. Can be either ‘http’ or ‘https’. Defaults to ‘http’ when your :s3_permissions are :public_read (the default), and ‘https’ when your :s3_permissions are anything else.

s3_headers: A hash of headers such as {‘Expires’ => 1.year.from_now.httpdate}

Hope this helps!