Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upload File to AWS S3 with Rails

I have an external application uploading a file to my rails web app. (Developed on Heroku, but that's not completely relevant)

I need to upload that file to AWS. I've successfully connected to AWS with rails, but I can't figure out how to access the file that was uploaded.

I know I need to do File.open({path to file}), then pass the File to AWS

like image 992
Colin Avatar asked Mar 29 '11 07:03

Colin


1 Answers

I forgot to set the multipart enctype in my test external application...if anyone else has this same problem this code should work:

AWS::S3::S3Object.store('{filename.ext_for_aws}',params[:{name_from_post}],'{bucket}')
like image 175
Colin Avatar answered Sep 27 '22 18:09

Colin