Download ActionDispatch :: Http :: UploadedFile To Amazon S3

How can I load ActionDispatch::Http::UploadedFile in Amazon S3?

 @file_data = params[:upload][:file] s3 = AWS::S3.new obj = s3.buckets['WeMake'].objects.create("video", file) 

Then I get this error: ArgumentError (: should the data be represented as a String, Pathname, File or an object that responds to #read and #eof?):

+4
source share
1 answer

I needed to access the actual file, params[:upload][:file].tempfile and add the file extension to the s3 upload, obj = s3.buckets['Bucket'].objects.create("video.mov", @file_data.tempfile) .

+11
source

Source: https://habr.com/ru/post/1493989/


All Articles