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 7968575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:05:56+00:00 2026-06-04T07:05:56+00:00

I created file upload using paperclip! File uploads as it is supposed to. Than

  • 0

I created file upload using paperclip! File uploads as it is supposed to.
Than I added file download method like this:

def download
    sample = Sample.find(params[:id])


    send_file  upload.sample.path,
    :filename => upload.sample_file_name,
                :type => upload.sample_content_type,
    :disposition => 'attachment'
    flash[:notice] = "Your file has been downloaded"
  end

But I cant figure out, what should I put in my show action so that I would be able to download the file?

I got as far as this:

<td><%= @sample.upload_file_name =%></td>
    <%= link_to 'Download', :action => :download, :path =>@sample.upload.url, :type => @sample.upload_content_type %>

But it shows error : Couldn’t find Sample with id=download

Can anyone help me?

  • 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-06-04T07:05:57+00:00Added an answer on June 4, 2026 at 7:05 am

    Think you need to change your link_to to send the :id (that’s what the controller action is looking for with params[:id])

    <%= link_to 'Download', :action => :download, :id => @sample.id %>
    

    Soz Karlis was writing as you posted 😀

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

Sidebar

Related Questions

I have created a function to upload a file using this library as follows:
I have created a file named MyFile.db using SQLite3 from my C#.net application. This
I am writing a file upload using Zend_Form_Element_File(). I created a directory called users
I allow users to upload a photo. This photo is stored using paperclip. The
I am using the Paperclip plugin to manage file uploads to my application. For
I have created a script to Upload a file using PHP. I have also
I want to upload an mp3 file using paperclip and i want to add
This was a question about testing file upload functionality using a local java server
I created a file download script in PHP, it works, but web browsers report
I have created the file upload control in GWT and have one submit button

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.