Hi,
To download file with the specific file name like song.mp3 as your
following url
http://192.168.1.105/download/servlet/download?filename=song.mp3
changed it with following url-
http://192.168.1.105/download/servlet/download/song.mp3?filename=song.mp3
.
So while downloading the extrapath song.mp3 will be the filename.
-Ketan
chiuming wrote:
>
> 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 your free @yahoo.com address at http://mail.yahoo.com