• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Specify the filename of a dynamically generated image?

 
Philippe Desrosiers
Ranch Hand
Posts: 138
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a servlet that dynamically generates images. Everything is working fine, except when the client application (say, a browser) attempts to save the image, the filename is something like imgserver.do.png. I would like to be able to control the filename of the generated image, as visible to the client. I know there is a way to do this, I think bby setting a response header, but I can't remember how. Can anyone help?

thanks,
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Search this forum and perhaps google for the term "content-disposition".
 
pawank gupta
Ranch Hand
Posts: 34
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use response.setHeader("contenttyep","application/gif");
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by pawank gupta:
use response.setHeader("contenttyep","application/gif");


The original poster asked about setting the file's name, not it's type.
 
Philippe Desrosiers
Ranch Hand
Posts: 138
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bear Bibeault:
Search this forum and perhaps google for the term "content-disposition".


This was a while ago, but setting the "content-disposition" header did indeed work.

thanks,
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use the content-disposition in which you can specify the name of the file.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic