Used send_data() for downloading xml file, How to ask location 4 the download

hello,
i m tryin to save a xml file using

send_data( out_data, :type => “text/xml”, filename => “sample.xml” )

where

“out_data” is the string instance that contains the generated XML,

“text/xml” is the mime type to be set in the response, and

“sample.xml” is the filename that will be presented to the client as
the name of the
file it attempts to download.

Where i m stuck is , the sample.xml is getting downloaded on desktop.
i want to ask the user to provide the location where he wants to
download the “sample.xml”.

i also used browse button to ask location and then send that location
to the filename parameter, in dat case the downloaded file is renamed
as …\location…\sample.xml.
and even then the file is saved on the desktop.

plz help me solve this problem. …thanks

Hi Pakhi,

Unfortunately, the server has no control whatsoever over what the
client application will do with the file. If your user is using
Firefox, it will usually ask you what you want to do with it. If your
users are using Safari, or Internet Explorer, it will usually simply
save to the default location. Other browsers behave similarly.

Julian.

Learn Ruby on Rails! CHECK OUT THE FREE VIDS (LIMITED TIME) NEW VIDEO
(#2) OUT NOW!
http://sensei.zenunit.com/

Thanks 4 ur reply Julian.

can i alter the download settings of a specific browser using
javascript in the view code of my application?

Not that I know of.

Julian.

Learn Ruby on Rails! CHECK OUT THE FREE VIDS (LIMITED TIME) NEW VIDEO
(#2) OUT NOW!
http://sensei.zenunit.com/

It won’t do a save-as, but you can specify it should save it as a file
rather than display inline.

Julian.

Learn Ruby on Rails! Check out the FREE VIDS (for a limited time)
VIDEO #3 out NOW!
http://sensei.zenunit.com/

Isn’t there a ‘content-disposition: attachment’ header thingy you can
add to get browsers to pop a save-as dialog for the response?

(Forgive my bad terminology–I’m not really ‘webby’…)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs