Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3965210
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:25:55+00:00 2026-05-20T03:25:55+00:00

Our app is hosted at Heroku, so no local file storage. A third party

  • 0

Our app is hosted at Heroku, so no local file storage.

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 [:filename] and [:tempfile] were for so I removed them and took a guess the syntax was something like this using Tempfile?)

  def post_audio_to_s3
    puts "*** POST_AUDIO_TO_S3 PARAMS:" + params.inspect

    con = AWS::S3::Base.establish_connection!(
      :access_key_id     => 'MYKEY',
      :secret_access_key => 'MYSECRET')

    puts "** CON='#{con.inspect}'"

    snd = AWS::S3::S3Object.store(params[:filename], 
                        Tempfile.open(params[:filename]).path, 
                        'bb_audios')
    puts "** SND='#{snd.inspect}'"

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 require 'tempfile' to the controller class and modified the S3 storage line to the above.

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T03:25:56+00:00Added an answer on May 20, 2026 at 3:25 am

    The answer was as follows. We had to change the url parameter from filename= to myfilename= because the rails magic automatically uses ‘filename’ for the POSTed data so they were stomping over each other in the params[].

    openme = params['filename'].tempfile.path
    
    snd = AWS::S3::S3Object.store(params[:myfilename], 
                            File.open(openme), 
                            'MYBUCKET')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Our app is hosted in Facebook. As you know, Facebook hosts third party app
for our rails 3 app, hosted at heroku, using haml (but not compass or
Our app (already deployed) is using an Access/Jet database. The upcoming version of our
Our app allows multiple files to be selected in a file selection dialog which
Our app uses a component that requires a license file in the directory with
Our app servers (weblogic) all use log4j to log to the same file on
In our app, we currently live with the legacy of a decision to store
I am developing an app using WF hosted in IIS as WCF services as
Our app provides an API that people can use to submit URLs like this:
I'm trying to build a very simple sinatra app deployed on heroku. our app

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.