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

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

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

    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


    DAC Guest

  2. Similar Questions and Discussions

    1. BinaryWrite Problem
      Hi All, Please help me regarding the 'Response.BinaryWrite' I am making one web application where I need to store some of client logo's and...
    2. SSL vs Response.BinaryWrite
      I am experiencing much the same thing here using BinaryWrite over SSL. Basically the exact same code that will deliver a PDF to the browser in a...
    3. Response.BinaryWrite
      Hi, How can I output the Response.BinaryWrite content in an asp page that has html tags inside? I need to write the binary data to the client...
    4. Free Original copy of Never Winter Nights for Linux going! (and its original)
      Hi, Yes you read the title correctly, being a complete idiot I ordered 2 copies of nwn from tuxgames, I could of sent it back, but I went on...
    5. HELP: writing a file to response buffer --> IE shows wrong filename
      Hi In an .aspx codebehind file I retrieve a file from a database and write it to the response buffer, so the browser pops up a 'save file' dialog...
  3. #2

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

    This line of code should do the trick:

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

    --
    I hope this helps,
    Steve C. Orr, MCSD
    [url]http://Steve.Orr.net[/url]


    "DAC" <tecnolog> wrote in message
    news:uNRnCk5VDHA.2016@TK2MSFTNGP09.phx.gbl...
    > 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
    >
    >

    Steve C. Orr, MCSD Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139