Filename of picture retrieved from database?

Discussion in 'ASP .Net' started by grz01@spray.se, Mar 24, 2005.

  1. Guest

    Hi,

    I have written a webpage, showpict.aspx,
    in C# that will fetch a jpg-picture from a database
    and display it thru a html-tag like:

    <img src="showpict.aspx?id=23">

    where the 'id' parameter tells what picture from the
    db to display.

    Problem is, if the user e.g. rightclicks the picture
    in the web-brower, then does 'Save Picture as...'
    the suggested file-extension is wrong.
    IE6 will suggest the filename: untitled.bmp
    while Firefox simply suggests: showpict.aspx.

    Q: How can I get the browser to suggest a name ending with .jpg?
    I have seen this work as desired on other sites...

    Is there a http-header to do this trick or what?

    Thanks,
     
    , Mar 24, 2005
    #1
    1. Advertising

  2. Patrice Guest

    Try :
    http://support.microsoft.com/kb/260519/en-us

    --

    <> a écrit dans le message de
    news:...
    >
    > Hi,
    >
    > I have written a webpage, showpict.aspx,
    > in C# that will fetch a jpg-picture from a database
    > and display it thru a html-tag like:
    >
    > <img src="showpict.aspx?id=23">
    >
    > where the 'id' parameter tells what picture from the
    > db to display.
    >
    > Problem is, if the user e.g. rightclicks the picture
    > in the web-brower, then does 'Save Picture as...'
    > the suggested file-extension is wrong.
    > IE6 will suggest the filename: untitled.bmp
    > while Firefox simply suggests: showpict.aspx.
    >
    > Q: How can I get the browser to suggest a name ending with .jpg?
    > I have seen this work as desired on other sites...
    >
    > Is there a http-header to do this trick or what?
    >
    > Thanks,
    >
     
    Patrice, Mar 24, 2005
    #2
    1. Advertising

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

    Here are more details:
    http://steveorr.net/articles/EasyUploads.aspx

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net



    <> wrote in message
    news:...
    >
    > Hi,
    >
    > I have written a webpage, showpict.aspx,
    > in C# that will fetch a jpg-picture from a database
    > and display it thru a html-tag like:
    >
    > <img src="showpict.aspx?id=23">
    >
    > where the 'id' parameter tells what picture from the
    > db to display.
    >
    > Problem is, if the user e.g. rightclicks the picture
    > in the web-brower, then does 'Save Picture as...'
    > the suggested file-extension is wrong.
    > IE6 will suggest the filename: untitled.bmp
    > while Firefox simply suggests: showpict.aspx.
    >
    > Q: How can I get the browser to suggest a name ending with .jpg?
    > I have seen this work as desired on other sites...
    >
    > Is there a http-header to do this trick or what?
    >
    > Thanks,
    >
     
    Steve C. Orr [MVP, MCSD], Mar 24, 2005
    #3
  4. Hi,

    Are you especifynng the correct content type?

    cheers,

    --
    Ignacio Machin,
    ignacio.machin AT dot.state.fl.us
    Florida Department Of Transportation


    <> wrote in message
    news:...
    >
    > Hi,
    >
    > I have written a webpage, showpict.aspx,
    > in C# that will fetch a jpg-picture from a database
    > and display it thru a html-tag like:
    >
    > <img src="showpict.aspx?id=23">
    >
    > where the 'id' parameter tells what picture from the
    > db to display.
    >
    > Problem is, if the user e.g. rightclicks the picture
    > in the web-brower, then does 'Save Picture as...'
    > the suggested file-extension is wrong.
    > IE6 will suggest the filename: untitled.bmp
    > while Firefox simply suggests: showpict.aspx.
    >
    > Q: How can I get the browser to suggest a name ending with .jpg?
    > I have seen this work as desired on other sites...
    >
    > Is there a http-header to do this trick or what?
    >
    > Thanks,
    >
     
    Ignacio Machin \( .NET/ C# MVP \), Mar 24, 2005
    #4
  5. Guest

    , Mar 25, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simnet
    Replies:
    0
    Views:
    386
    Simnet
    Dec 3, 2004
  2. dungdang
    Replies:
    2
    Views:
    415
    dungdang
    Jun 13, 2007
  3. zxo102
    Replies:
    11
    Views:
    1,082
    Mark Tolonen
    Dec 29, 2008
  4. John Wilson
    Replies:
    2
    Views:
    155
    John Wilson
    Jul 16, 2003
  5. Replies:
    8
    Views:
    1,298
    Mick White
    Apr 19, 2005
Loading...

Share This Page