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

  • Home
  • SEARCH
  • 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 4624886
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:11:37+00:00 2026-05-22T03:11:37+00:00

Ive got an anchor link <a href=http://bucket_name.amazonaws.com/uploads/users/4/songs/7/test.mp3>Download</a> How do I make it so when

  • 0

Ive got an anchor link

<a href="http://bucket_name.amazonaws.com/uploads/users/4/songs/7/test.mp3">Download</a> 

How do I make it so when a user clicks on it, it actually opens a popup asking the user to save the file instead of trying to play the file on the browser?

EDIT:

I was reading this article.

  def download
    data = open(Song.first.attachment)
    send_data data.read, :type => data.content_type, :x_sendfile=>true
  end

The article suggest using x_sendfile, since send_file takes up an http process with the potential risk of hanging the app until the download is completed.

Second, I am using send_data instead of send_file, which seems to work if the file is remote (i.e. hosted on Amazon S3). As suggested by this article.

The article, I mentioned was posted on 2009. Is x_sendfile=>true still necessary? Will it hang the app if it isn’t included?

Should I really be using send_data or send_file?

  • 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-22T03:11:38+00:00Added an answer on May 22, 2026 at 3:11 am

    You can manage your file downloading with separate controller, if you don’t want to eal with HTTP server configurations.

    So you can send_file with disposition option as attachment.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ive got a url: http://dev.local/foodies/view?id=bluedaniel and ive got in my bootstrap: protected function _initRoute()
I've got an html anchor element: <a title=Some stuff here>Link Text</a> ...and I want
I've run into a small problem, Ive got a page full of anchor tags
Ive got a div that i want to slide out on click using .show(slide,
Ive got a div thats hidden with .hide and on click opens using .show(slide,
ive got this exception. My Object looks like this: @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class ObjectDTO
Ive got a long list of xml elements. Each element got an ID and
Ive got the following code which I hacked together from website examples. It works
Ive got a view helper in library/my/view/helper/gravatar and so in any view I can
Ive got the following html setup: <div id=div1> <div id=content1>blaat</div> <div id=content1>blaat2</div> </div> it

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.