# Choose a directory path

**URL:** <https://www.ruby-forum.com/t/choose-a-directory-path/178540>\
**Category:** Rails\
**Created:** [November 6, 2009, 6:34am UTC](https://www.ruby-forum.com/t/choose-a-directory-path/178540 "2009-11-06T06:34:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![salil](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c89c15/32.png) [@salil](https://www.ruby-forum.com/u/salil)\
**Post date:** [November 6, 2009, 6:34am UTC](https://www.ruby-forum.com/t/choose-a-directory-path/178540/1 "2009-11-06T06:34:15Z")

</div>

Hello everyone,

How to give the functionality to choose a directory path to save a file  
by a user?

Thanks in advance…

---

<div class="post-metadata">

**Author:** ![salil](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c89c15/32.png) [@salil](https://www.ruby-forum.com/u/salil)\
**Post date:** [November 6, 2009, 11:16pm UTC](https://www.ruby-forum.com/t/choose-a-directory-path/178540/2 "2009-11-06T23:16:39Z")

</div>

On Nov 6, 12:34 am, Salil G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Hello everyone,
> 
> How to give the functionality to choose a directory path to save a file  
> by a user?

Save a file where? On the server’s filesystem or the client’s? Not  
much info in this question…

–Matt J.

---

<div class="post-metadata">

**Author:** ![salil](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c89c15/32.png) [@salil](https://www.ruby-forum.com/u/salil)\
**Post date:** [November 7, 2009, 5:07am UTC](https://www.ruby-forum.com/t/choose-a-directory-path/178540/3 "2009-11-07T05:07:18Z")

</div>

> Save a file where? On the server’s filesystem or the client’s? Not  
> much info in this question…
> 
> –Matt J.

Hi Matt,

I want to save file at Client’s System.

Thanks,

Salil G.

---

<div class="post-metadata">

**Author:** ![salil](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c89c15/32.png) [@salil](https://www.ruby-forum.com/u/salil)\
**Post date:** [November 8, 2009, 10:14am UTC](https://www.ruby-forum.com/t/choose-a-directory-path/178540/4 "2009-11-08T10:14:40Z")

</div>

Salil G. wrote:

> > Save a file where? On the server’s filesystem or the client’s? Not  
> > much info in this question…
> > 
> > –Matt J.
> 
> Hi Matt,
> 
> I want to save file at Client’s System.
> 
> Thanks,
> 
> Salil G.

Hi Salil,

I think you want download file option. For example on hitting a URL you  
want user to download a zip file code for it you can do something like  
this -

class MyController \< ApplicationController

def downloadzip  
send\_file “path\_to\_file”, :type=\>“application/zip”  
end  
end

Thanks  
– Prasad  
[http://roorky.com](http://roorky.com)  
Interactive Programming Books

---

<div class="post-metadata">

**Author:** ![salil](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c89c15/32.png) [@salil](https://www.ruby-forum.com/u/salil)\
**Post date:** [November 7, 2009, 8:34pm UTC](https://www.ruby-forum.com/t/choose-a-directory-path/178540/5 "2009-11-07T20:34:11Z")

</div>

On Nov 6, 11:07 pm, Salil G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > Save a file where? On the server’s filesystem or the client’s? Not  
> > much info in this question…
> 
> > –Matt J.
> 
> Hi Matt,
> 
> I want to save file at Client’s System.

The most reliable way to get a file to download every time (regardless  
of content type) is to send a Content-Disposition header set to  
‘attachment’. See this doc:

> **[How to raise file download dialog box for known MIME types - Browsers](https://learn.microsoft.com/en-US/troubleshoot/developer/browsers/development-website/raise-file-download-for-mime-types)**
>
> Introduces how to change the default behavior to raise a file download dialog box for known MIME types to save a file in Microsoft Edge and Internet Explorer.

(on the MS KB, but the header works everywhere).

–Matt J.
