By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,491 Members | 1,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,491 IT Pros & Developers. It's quick & easy.

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

P: n/a
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/default...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

--
5k**********@sneakemail.com
Jul 19 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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" <Se********@The.Bottom.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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

Jul 19 '05 #2

P: n/a
I doubt this has anything to do with your code.

http://www.aspfaq.com/kbsearch.asp?q...ernet+explorer
--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"James" <Se********@The.Bottom.com> wrote in message
news:#R**************@TK2MSFTNGP10.phx.gbl...
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/default...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

--
5k**********@sneakemail.com

Jul 19 '05 #3

P: n/a
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:ud**************@tk2msftngp13.phx.gbl...
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" <Se********@The.Bottom.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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


Jul 19 '05 #4

P: n/a
> 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/
Jul 19 '05 #5

P: n/a
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" <aa***@TRASHaspfaq.com> wrote in message
news:Ov**************@TK2MSFTNGP10.phx.gbl...
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/

Jul 19 '05 #6

P: n/a
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" <Se********@The.Bottom.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
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" <aa***@TRASHaspfaq.com> wrote in message
news:Ov**************@TK2MSFTNGP10.phx.gbl...
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/


Jul 19 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.