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

J

James

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
 
J

James

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

James

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.
 
J

James

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top