The server sends a header that describes the file type.
See mime types.


At 10:45 AM 9/12/2001, you wrote:
>But how exactly does web server instruct web browser
>to save the stream of bytes into a filename as
>
>filename on server?
>
>Does web server send any HTTP header like
>Content-Disposition to specify the file name to save?
>
>Since If i dont' set any HTTP headers in my servlet
>but just send the bytes.  Browser will save the
>
>file as servlet name.
>
>thanks again
>
>
>
>--- Alexander  Jesse <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > have you tried with different browsers? I remember
> > vaguely that
> > this kind of stuff can also be working in one
> > browser and
> > not work in another one...
> >
> > regards
> > Alexander
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, September 11, 2001 11:53 PM
> > To: [EMAIL PROTECTED]
> > Subject: file download servlet
> >
> >
> >
> > I asked this question before, but I didn't get any
> > reply. I post it again in hope someone could give me
> > some hint.
> >
> > I have a file download servlet serves web browsers.
> >
> > request to file is like this
> >
>http://192.168.1.105/download/servlet/download?filename=song.mp3
> >
> > The file on the server side is song.mp3.  But the
> > file
> > got download to
> > browser is the servlet name instead.  :(
> >
> > I heard i need to use the HTTP header
> > res.setHeader("Content-Disposition","attachment;
> > filename=\"" +
> > downloadFile + "\";");
> >
> > Is Content-Disposition a standard header in HTTP
> > spec?
> >  I heard i should use this whenever I don't want the
> > content display on browser (force Save as Dialog
> > box)
> >
> > Why everytime I download a file from the web server
> > like song.mp3.
> > there is no such HTTP header from web server? -->
> > Content-Disposition
> >
> > I think web server is just like a download servlet.
> > It
> > sends raw bytes to web browser. After browser get
> > the
> > bytes, It will not konw what name the file should
> > save
> > as.  Web server must send some kind of HTTP header
> > to
> > tell web browser what file name the file is saved
> > as.
> > right?
> >
> > How exactly is web server instruct web browser to
> > pop
> > up Save as Dialog box (on unknown mime type) and
> > save
> > the file with name = filename on server?  Does web
> > server use any special HTTP Header (like
> > Content-Disposition)
> >
> >
> > thanks.
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Get email alerts & NEW webcam video instant
> > messaging with Yahoo! Messenger
> > http://im.yahoo.com
>
>
>__________________________________________________
>Do You Yahoo!?
>Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
>http://im.yahoo.com

Reply via email to