samedi 4 avril 2015

Download files from Aws S3 by using carrierwave + fog

I have a simple app in Rails which allows me to upload file to Amazon S3 by using Carrierwave and fog. It works fine. I'm now working on downloading the files and display them on the browser. It works. However, the private link (which I set it to be a temporary link) from S3 is shown on browser, like:


http://ift.tt/1FsY5bs


I don't want to explore the private link from S3. Instead, I wish the link like below is shown: http://ift.tt/1FsY7Qs


I have a model resume.rb



class Resume < ActiveRecord::Base
mount_uploader :attachment, ResumeUploader
end


Controller with show action



def show
@resume = Resume.find(params[:id])
@resume_name = @resume.attachment.path.split("/").last
end


And my with show.html.erb



<%= link_to @resume_name, @resume.attachment.url %>


Could anyone please tell me how can I show the file one the browser without showing the private url from S3?





Aucun commentaire:

Enregistrer un commentaire