I have a Flex application where the user clicks on a "download" button to 
download a file from the server. 

In my previous DHTML incarnation of the same application, on click of a 
download button I sent a request to my servlet which writes out the file bytes 
to o/p stream and sets the following:
response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "attachment; filename=\"foo.pdf"\"");
On download, the Browser pops up the standard dialog asking the user "What 
should Firefox do with this file?" with 2 options - 'Open with' or 'Save File'. 
The user can just open the file or save it to disk.

I want the same behavior in my Flex app. Using FileReference and the same 
servlet in the back-end, I can download the file and prompt the user to save it 
to disk but can't give him the option of Opening the file directly without 
first saving. Using URLLoader, I don't even know how to Save to disk - my 
Event.COMPLETE handler registered with URLLoader gets called when the download 
is complete, but what do I do in the handler?

Anyone know how I could give the user the Open or Save choice on download of a 
file using URLLoader or FileReference or something else?

Thanks
Vijay

  

Reply via email to