right clicking and saving pictures from my web site, i want to alow but not working.

Discussion in 'ASP General' started by James, Feb 6, 2004.

  1. James

    James Guest

    when i right click and try to save a picture from my web site it some times
    defaults the name and file type to 'unknown' bmp. the file is really a jpeg
    that i am using the .binarywrite to display the image (so that im not
    revailing my picture path to my users). the strange thing is some times it
    will default as the correct file name and image type that i specified in the
    ..addheader method. any ideas why this some times works and some times
    doesn't? just take the vb dll code at the bottom and make a active x dll in
    vb and name the project ASPBinFile2 and the class clsASPBinFile.
    more information at:
    http://www.psacake.com/web/gj.asp
    and
    http://support.microsoft.com/defaul...port/kb/articles/Q193/9/98.ASP&NoWebContent=1

    heres my asp code:
    <%
    FilePath = "d:\pictures\blah.jpg"
    On Error Resume Next
    If Not Response.isClientConnected Then
    Response.end
    End If
    Response.buffer = true
    'Specify a MIME type
    Response.contenttype = "image/jpeg"
    'Custom server component
    Set objBinFile = Server.CreateObject("ASPBinFile.clsASPBinFile")
    mStream = objBinFile.BinFileRead(FilePath)
    Response.Addheader "Content-Disposition", "inline; filename=" & "blah.jpg"
    Response.CacheControl = "public"
    Response.binarywrite mstream
    Set objBinFile = Nothing
    Response.End

    here is the vb active x dll that i created using vb6 (code was solen from
    psacake.com i thought i better give credits.)

    Option Explicit

    Function BinFileRead(ByVal inFileSpec As String) As Variant
    On Error GoTo errHandler
    Dim mHandle
    Dim lngFileLen As Long
    Dim arrData() As Byte

    mHandle = FreeFile
    Open inFileSpec For Binary Access Read As #mHandle

    lngFileLen = FileLen(inFileSpec)
    ReDim arrData(lngFileLen)

    Get #mHandle, , arrData
    Close #mHandle

    BinFileRead = arrData
    Exit Function

    errHandler:
    End Function



    --
     
    James, Feb 6, 2004
    #1
    1. Advertising

  2. James

    Ray at Guest

    It's quite possible that this is actually an IE issue and there's nothing
    wrong with your code.

    http://support.microsoft.com/?kbid=810978

    Ray at work

    "James" <> wrote in message
    news:%...
    > when i right click and try to save a picture from my web site it some

    times
    > defaults the name and file type to 'unknown' bmp. the file is really a

    jpeg
    > that i am using the .binarywrite to display the image (so that im not
    > revailing my picture path to my users). the strange thing is some times it
    > will default as the correct file name and image type that i specified in

    the
    > .addheader method. any ideas why this some times works and some times
    > doesn't? just take t
     
    Ray at, Feb 6, 2004
    #2
    1. Advertising

  3. I doubt this has anything to do with your code.

    http://www.aspfaq.com/kbsearch.asp?q=save as bmp internet explorer


    --
    Aaron Bertrand
    SQL Server MVP
    http://www.aspfaq.com/




    "James" <> wrote in message
    news:#...
    > when i right click and try to save a picture from my web site it some

    times
    > defaults the name and file type to 'unknown' bmp. the file is really a

    jpeg
    > that i am using the .binarywrite to display the image (so that im not
    > revailing my picture path to my users). the strange thing is some times it
    > will default as the correct file name and image type that i specified in

    the
    > .addheader method. any ideas why this some times works and some times
    > doesn't? just take the vb dll code at the bottom and make a active x dll

    in
    > vb and name the project ASPBinFile2 and the class clsASPBinFile.
    > more information at:
    > http://www.psacake.com/web/gj.asp
    > and
    >

    http://support.microsoft.com/defaul...port/kb/articles/Q193/9/98.ASP&NoWebContent=1
    >
    > heres my asp code:
    > <%
    > FilePath = "d:\pictures\blah.jpg"
    > On Error Resume Next
    > If Not Response.isClientConnected Then
    > Response.end
    > End If
    > Response.buffer = true
    > 'Specify a MIME type
    > Response.contenttype = "image/jpeg"
    > 'Custom server component
    > Set objBinFile = Server.CreateObject("ASPBinFile.clsASPBinFile")
    > mStream = objBinFile.BinFileRead(FilePath)
    > Response.Addheader "Content-Disposition", "inline; filename=" & "blah.jpg"
    > Response.CacheControl = "public"
    > Response.binarywrite mstream
    > Set objBinFile = Nothing
    > Response.End
    >
    > here is the vb active x dll that i created using vb6 (code was solen from
    > psacake.com i thought i better give credits.)
    >
    > Option Explicit
    >
    > Function BinFileRead(ByVal inFileSpec As String) As Variant
    > On Error GoTo errHandler
    > Dim mHandle
    > Dim lngFileLen As Long
    > Dim arrData() As Byte
    >
    > mHandle = FreeFile
    > Open inFileSpec For Binary Access Read As #mHandle
    >
    > lngFileLen = FileLen(inFileSpec)
    > ReDim arrData(lngFileLen)
    >
    > Get #mHandle, , arrData
    > Close #mHandle
    >
    > BinFileRead = arrData
    > Exit Function
    >
    > errHandler:
    > End Function
    >
    >
    >
    > --
    >
    >
    >
     
    Aaron Bertrand - MVP, Feb 6, 2004
    #3
  4. James

    James Guest

    it happens on with this one issuse. all other pictures i save from the
    internet work fine.

    "Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
    message news:...
    > It's quite possible that this is actually an IE issue and there's nothing
    > wrong with your code.
    >
    > http://support.microsoft.com/?kbid=810978
    >
    > Ray at work
    >
    > "James" <> wrote in message
    > news:%...
    > > when i right click and try to save a picture from my web site it some

    > times
    > > defaults the name and file type to 'unknown' bmp. the file is really a

    > jpeg
    > > that i am using the .binarywrite to display the image (so that im not
    > > revailing my picture path to my users). the strange thing is some times

    it
    > > will default as the correct file name and image type that i specified in

    > the
    > > .addheader method. any ideas why this some times works and some times
    > > doesn't? just take t

    >
    >
     
    James, Feb 6, 2004
    #4
  5. Aaron Bertrand - MVP, Feb 6, 2004
    #5
  6. James

    James Guest

    i want to show them the picture, if they choose to download it they can. i
    don't want to shove it down there throats :) thanks for the code tho im
    playing with it maybe i can get it to show the image too.


    "Aaron Bertrand - MVP" <> wrote in message
    news:...
    > > here is the vb active x dll that i created using vb6

    >
    > Why do you think you need your own "vb active x dll"?
    >
    > http://www.aspfaq.com/2161
    >
    > --
    > Aaron Bertrand
    > SQL Server MVP
    > http://www.aspfaq.com/
    >
    >
     
    James, Feb 6, 2004
    #6
  7. James

    James Guest

    ok after following the directions of that site (which is a good idea) it
    makes it display the image insted of automaticly opening it. but still it
    does the same things with the name, it somes times displays Unknown and some
    times displays the correct file name.


    "James" <> wrote in message
    news:%...
    > i want to show them the picture, if they choose to download it they can. i
    > don't want to shove it down there throats :) thanks for the code tho im
    > playing with it maybe i can get it to show the image too.
    >
    >
    > "Aaron Bertrand - MVP" <> wrote in message
    > news:...
    > > > here is the vb active x dll that i created using vb6

    > >
    > > Why do you think you need your own "vb active x dll"?
    > >
    > > http://www.aspfaq.com/2161
    > >
    > > --
    > > Aaron Bertrand
    > > SQL Server MVP
    > > http://www.aspfaq.com/
    > >
    > >

    >
    >
     
    James, Feb 6, 2004
    #7
    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. UJ
    Replies:
    1
    Views:
    305
  2. Martin Raychev
    Replies:
    1
    Views:
    290
    Alvin Bruney [MVP]
    Mar 2, 2004
  3. Lucas
    Replies:
    4
    Views:
    174
    Andrew Stewart
    Mar 16, 2007
  4. Leon
    Replies:
    3
    Views:
    183
    TaeHo Yoo
    Nov 26, 2004
  5. pavi
    Replies:
    0
    Views:
    1,358
Loading...

Share This Page