• Post Reply Bookmark Topic Watch Topic
  • New Topic

Downloading a jpeg image in new window  RSS feed

 
R . Ravi Kumar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm trying to open different types of Attachments. All The attachments are opening with their respective applications In new window.

E.g .doc in MSWord.

Whereas coming to JPEG, gif files. These are opening in the same window . I need to open them in new window.
I placed this code also :

response.setHeader("Content-Disposition","attachment;fileName=".concat(String.valueOf(destFileName)));

BufferedInputStream bis = new BufferedInputStream(blobStream);
response.setContentLength((int)blob.length());
int aByte = 0;
while ((aByte = bis.read()) != -1) {
response.getOutputStream().write(aByte);
}
bis.close();
response.flushBuffer();
Please help me.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the servlet side you can't force the browser to open a new window. That has to be done on the browser side with HTML or JavaScript.
Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!