# Rails form field to ask for directory to download to

**URL:** <https://www.ruby-forum.com/t/rails-form-field-to-ask-for-directory-to-download-to/187163>\
**Category:** Rails\
**Created:** [April 19, 2010, 12:11am UTC](https://www.ruby-forum.com/t/rails-form-field-to-ask-for-directory-to-download-to/187163 "2010-04-19T00:11:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pitosalas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a4c791/32.png) [@pitosalas](https://www.ruby-forum.com/u/pitosalas)\
**Post date:** [April 19, 2010, 12:11am UTC](https://www.ruby-forum.com/t/rails-form-field-to-ask-for-directory-to-download-to/187163/1 "2010-04-19T00:11:49Z")

</div>

Hi all,

I need a way to ask a user to supply a directory on their computer (i.e.  
client) to which to download a series of files. So in other words, the  
user is asked:

Please indicate directory to download to: …

And they click or something and get a chooser with which they can point  
to a directory on their computer. (Not a file, a directory, that may not  
yet exist, or that may be empty.)

There must be a gem or something out there to help do this in a cross  
platform way, can anyone point the way?

Thanks a lot!

Pito

---

<div class="post-metadata">

**Author:** ![pitosalas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a4c791/32.png) [@pitosalas](https://www.ruby-forum.com/u/pitosalas)\
**Post date:** [April 19, 2010, 12:36am UTC](https://www.ruby-forum.com/t/rails-form-field-to-ask-for-directory-to-download-to/187163/2 "2010-04-19T00:36:45Z")

</div>

Hassan S. wrote:

> Not a server-side process, this happens on the client – google  
> “file download Content-Disposition”

Yes but as I said in my question, I want the user to designate a  
directory to receive file(s), not a specific file name to download into.  
I am guessing that the solution will involve some javascript/ajax/or  
something, and I am also guessing that the browser inherently doesn’t  
have a feature to raise a chooser dialog box to choose a destination  
folder (not filename.)

(Note: if I want to receive files in a directory called ~/mydownloads  
then I need a dialog box that lets me navigate my directory structure  
locally, but choose a directory not a file. The normal file open dialog  
box displayed by a browser makes me choose an existing file, as far as I  
understand…)

---

<div class="post-metadata">

**Author:** ![pitosalas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a4c791/32.png) [@pitosalas](https://www.ruby-forum.com/u/pitosalas)\
**Post date:** [April 19, 2010, 12:29am UTC](https://www.ruby-forum.com/t/rails-form-field-to-ask-for-directory-to-download-to/187163/3 "2010-04-19T00:29:04Z")

</div>

On Sun, Apr 18, 2010 at 3:11 PM, Pito S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> And they click or something and get a chooser with which they can point  
> to a directory on their computer. (Not a file, a directory, that may not  
> yet exist, or that may be empty.)
> 
> There must be a gem or something out there to help do this in a cross  
> platform way, can anyone point the way?

Not a server-side process, this happens on the client – google  
“file download Content-Disposition”

–  
Hassan S. ------------------------ removed\_email\_address@domain.invalid  
twitter: @hassan

---

<div class="post-metadata">

**Author:** ![pitosalas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a4c791/32.png) [@pitosalas](https://www.ruby-forum.com/u/pitosalas)\
**Post date:** [April 19, 2010, 1:04am UTC](https://www.ruby-forum.com/t/rails-form-field-to-ask-for-directory-to-download-to/187163/4 "2010-04-19T01:04:12Z")

</div>

On Sun, Apr 18, 2010 at 3:36 PM, Pito S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Yes but as I said in my question, I want the user to designate a  
> directory to receive file(s), not a specific file name to download into.

I think this is totally browser, user-specified browser preferences,  
and OS dependent, so I wouldn’t count on a server-side solution.

But good luck 🙂

–  
Hassan S. ------------------------ removed\_email\_address@domain.invalid  
twitter: @hassan
