Note that there are some explanatory texts on larger screens.

plurals
  1. POrails 3, heroku, aws-s3, simply trying to upload a file to S3 that is POSTed (http/multipart) to our app
    primarykey
    data
    text
    <p>Our app is hosted at Heroku, so no local file storage.</p> <p>A third party api we're using doesn't store a WAV it creates, it POSTs the file (http/multi-part) back to our app. They provide sample code to 'simply' send that file on to S3. The code they supply (below) doesn't run on Rails 3 + Heroku. I suspect there's some different syntax for specifying the input file and temp file from which we read. (The code was originally for Sinatra. I have NO idea what the old <code>[:filename]</code> and <code>[:tempfile]</code> were for so I removed them and took a guess the syntax was something like this using Tempfile?)</p> <pre><code> def post_audio_to_s3 puts "*** POST_AUDIO_TO_S3 PARAMS:" + params.inspect con = AWS::S3::Base.establish_connection!( :access_key_id =&gt; 'MYKEY', :secret_access_key =&gt; 'MYSECRET') puts "** CON='#{con.inspect}'" snd = AWS::S3::S3Object.store(params[:filename], Tempfile.open(params[:filename]).path, 'bb_audios') puts "** SND='#{snd.inspect}'" </code></pre> <p>UPDATE: Almost works ,but zero length file created. I'm sort of flailing around with no idea how to use the Tempfile, but I added <code>require 'tempfile'</code> to the controller class and modified the S3 storage line to the above. </p> <p>This whole POST-a-file to Heroku/Tempfile thing has my brain iced... any ideas would be appreciated. For one thing... I have no idea where the DATA comes from... shouldnt I see something besides the filename when I inspect the params if it's being POSTED to the app?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload