Forum: Ruby on Rails downloading the files from specific location

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
srikanth (Guest)
on 2009-01-29 15:28
(Received via mailing list)

I have group of streams in  public/data folder.
Here i want to download the any selected stream from datafolder.

I have tried to download using 'send_data' in my show method of
controller like below:

send_data(@stream.location,:filename =>,:disposition =>

i have hyperlink called show ,if i press the link it is opening the
file with stream as content.
ex:i have cmd.txt in data folder,once i press the link it open cmd.txt
as a file and in that file it will have filename itself.

here i want to download the actual file.

can any one suggest how to do download from any location and is is
possible to download with send_data?

Andrew T. (Guest)
on 2009-01-29 16:18
(Received via mailing list)
On Thu, Jan 29, 2009 at 3:27 PM, srikanth <removed_email_address@domain.invalid> 

> 'download')
> thanks
> Srikanth
> >
If I've understood your question correctly, the file is opening in the
browser and now presenting the save dialog
Try using :disposition => 'attachment'

Andrew T.

"I have never let my schooling interfere with my education" - Mark Twain
sreekanth.G (Guest)
on 2009-01-29 16:50
(Received via mailing list)
thanks for the reply
result is same i.e actual file is not having any data.


On Thu, Jan 29, 2009 at 7:46 PM, Andrew T.
This topic is locked and can not be replied to.