HOW-TO: Response.BinaryWrite JPG *WITH* the original filename

  • Thread starter Thread starter DAC
  • Start date Start date
D

DAC

Hello.
How can I Respose.BinaryWrite a file but preserving the original filename.

Explaining better:
Suppose a webform that displays images stored on my database. The page
shows, say, 5 pics at a time.
I want the user to be able to right-click over a pic and use "Save Picture
As..." from IE.
But, since the image is "BinaryWritten", the user gets the filename of my
image generator page. I want to force IE to use the original name for the
pic I have stored in my DB.

Besides Context.Response.ContentType = "image/jpg", is there any other
header I have to set?

Thanks in advance,
Daniel
 
This line of code should do the trick:

Response.AddHeader("Content-Disposition","inline;filename=myname.jpg");
 
Back
Top