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