#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    4
    Rep Power
    0

    Question Save To Dialog BOX


    In a JSP I have the link to a File on my HD. What should I do so when i click on the link, it opens me a dialog box and asks me where to save it instead of opening the file in the page?
  2. #2
  3. No Profile Picture
    Clueless llama
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Feb 2001
    Location
    Lincoln, NE. USA
    Posts
    2,353
    Rep Power
    117
    This is actually a basic html question. What kind of file is it?

    EDIT: I take this back. It is a basic http question and thought not technically a java problem, it was appropriate for this forum imo.
    Last edited by Nemi; March 18th, 2003 at 04:06 PM.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    4
    Rep Power
    0
    any kind.... doc, zip, etc.
    it will only open the dialog with a .zip file. otherwise, it will open the file
  6. #4
  7. No Profile Picture
    Clueless llama
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Feb 2001
    Location
    Lincoln, NE. USA
    Posts
    2,353
    Rep Power
    117
    You need to set the Content-disposition header.
    Code:
    response.setHeader("Content-Disposition", "attachment");
    
    optional:
    response.setHeader("Content-Disposition", "attachment; filename=useThisName.doc; size=1234");
    The filename-parm tells the browser to put that name in the save dialog by default. The size-parm tells the browser how big the file is going to be. I believe this will give you that "time left" dialog in windows when downloading a large file. Without the size-parm it wil just give you a generic download speed dialog when downloading.

    specs here:
    http://www.ietf.org/rfc/rfc2183.txt
    Last edited by Nemi; March 20th, 2003 at 09:55 AM.

IMN logo majestic logo threadwatch logo seochat tools logo