Hi there.
Its working well with the firefox browser. I checked out without XP firewall.
When I click the link to open/ download a
word file, its showing the (File Download warning) content disposition window but when I click save or open,,, I get error message "Internet Explorer cannot download ...File_name.doc from Server_name.
Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later. "
In the content disposition window ( file download warning window), "File Name" is the filename path, and "From" is the server name/path. but nothing is displayed in "File Type"! Hope this might have something to do. Please help me out.
My code is as follows
if (!request.getScheme().equals("https"))
response.setHeader("Pragma", "no-cache");
String fileName=request.getParameter("instruction");
//filename = filename.replaceAll( "\\W*", "" ) ;
String DirName = request.getParameter("directory");
String value = (DirName+"/"+fileName);
File f = new File (value);
response.setContentType("application/msword");
//set the header and also the Name by which user will be prompted to save
response.setHeader("Content-disposition", "attachment; filename=" + fileName);
response.setHeader("Cache-Control", "cache");
response.setHeader("Cache-Control", "must-revalidate");
InputStream in = new FileInputStream(f);
out.clearBuffer();
int bit = 256;
int i = 0;
try {
while ((bit) >= 0) {
bit = in.read();
out.write(bit);
}
} catch (IOException ioe) {
ioe.printStackTrace(System.out);
}
out.flush();
out.close();
in.close();