Hi all:
I have a problem when using the following code to push a file to
user:
HttpServletRequest response;
filename = "foo bar.idx"
response.setContentType("application/mubot.bitmap");
response.setHeader(
"Content-disposition",
"attachment;filename=" + filename);
The file name show in the download dialogue is "foo", which is
expected to be "foo bar.idx", I think it may be caused by the space
between "foo" and "bar", so how can I fix it?
Appreciate your help!
Andrew Thompson - 27 Mar 2007 11:08 GMT
..
> The file name show in the download dialogue is "foo", which is
> expected to be "foo bar.idx", I think it may be caused by the space
> between "foo" and "bar", so how can I fix it?
Note the output;
<sscce>
import java.io.File;
class SpaceInName {
public static void main(String[] args) throws Exception {
File file = new File("foo bar.idx");
System.out.println( file.toURI().toURL() );
}
}
</sscce>
HTH
Andrew T.