# Simple non-streaming download with different filename

**URL:** <https://www.ruby-forum.com/t/simple-non-streaming-download-with-different-filename/113163>\
**Category:** Rails\
**Created:** [August 28, 2007, 9:50am UTC](https://www.ruby-forum.com/t/simple-non-streaming-download-with-different-filename/113163 "2007-08-28T09:50:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![phoenixy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/71e660/32.png) [@phoenixy](https://www.ruby-forum.com/u/phoenixy)\
**Post date:** [August 28, 2007, 9:50am UTC](https://www.ruby-forum.com/t/simple-non-streaming-download-with-different-filename/113163/1 "2007-08-28T09:50:24Z")

</div>

Hi,  
I’m trying to make download available through Rails.  
I know there’s send\_data / send\_file method in rails, but they’re  
streaming download so that the process serving file is kept alive.  
Web hosting services usually do not allow a long-lived process and  
therefore download always fails.(It’s disconnected around 2-3 minutes)

So, I want to just use http header to download file.  
However, I want the file’s name to be different from the physical file  
name in the server.

I know that it can be done using ‘Content-Disposition’ header.  
So, I tried this…

def download  
response.header[‘content-type’] = ‘application/force-download’  
response.header[‘content-disposition’] = ‘attachment; filename=“new file  
name”’  
redirect\_to URL\_OF\_FILE  
end

however, it just redirects to the file and the download(save) dialog box  
shows the physical file name, not the new file name that I want to show  
to user.

What should I do to make it possible?

Thank you in advance.
