# Specify filename using rails Metal

**URL:** <https://www.ruby-forum.com/t/specify-filename-using-rails-metal/189488>\
**Category:** Rails\
**Created:** [June 1, 2010, 6:18pm UTC](https://www.ruby-forum.com/t/specify-filename-using-rails-metal/189488 "2010-06-01T18:18:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![guillaume](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/c67d28/32.png) [@guillaume](https://www.ruby-forum.com/u/guillaume)\
**Post date:** [June 1, 2010, 6:18pm UTC](https://www.ruby-forum.com/t/specify-filename-using-rails-metal/189488/1 "2010-06-01T18:18:57Z")

</div>

Hi,

I’m using Rails Metal to serve certain files,  
But i don’t know how to change the filename …

Here is the code in Metal where i send the file :  
[200, { ‘Content-Type’ =\> file.content\_type}, [file.read]]

I tried to specify ‘filename’=\>‘test.zip’… but without success…

Anyone has a clue ?

Thanks,  
regards.

---

<div class="post-metadata">

**Author:** ![guillaume](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/c67d28/32.png) [@guillaume](https://www.ruby-forum.com/u/guillaume)\
**Post date:** [June 1, 2010, 6:24pm UTC](https://www.ruby-forum.com/t/specify-filename-using-rails-metal/189488/2 "2010-06-01T18:24:14Z")

</div>

On Jun 1, 5:17 pm, guillaume [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi,
> 
> I’m using Rails Metal to serve certain files,  
> But i don’t know how to change the filename …
> 
> Here is the code in Metal where i send the file :  
> [200, { ‘Content-Type’ =\> file.content\_type}, [file.read]]
> 
> I tried to specify ‘filename’=\>‘test.zip’… but without success…

Are you trying to set the name that the browser saves the file as? If  
so then you need to set a Content-Disposition header ( see  
[http://www.ietf.org/rfc/rfc2183.txt](http://www.ietf.org/rfc/rfc2183.txt) )

Fred
