Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Serving binary files


Message #1 by louis@l... on Wed, 27 Feb 2002 11:20:37
Hi,



I am new to these groups and to asp so apologies if this question has been 

asked before.



I am trying to find out how to write a binary file using 

response.binarywrite. I am working on an image based site and want to 

serve requested images via an asp file.



I have tried the following code which seems to be unable to create the 

server object perhaps because I am missing a component?



<%



Dim Picture

response.contenttype = "image/jpeg"

set ObjBin = server.createobject("bin.binary")

Picture = ObjBin.ReadFile("./test.jpg")

response.binarywrite(Picture)

set ObjBin = Nothing



%>



Can anyone tell me how this should be done. 

Perhaps worth a mention is that I am using PWS on win98 so currently can 

only test asp 2 stuff. 



Regards



Louis



Message #2 by "Ken Schaefer" <ken@a...> on Thu, 28 Feb 2002 10:58:37 +1100
I've never heard of the bin.binary component. It's not part of the standard

IIS/PWS install, and must be a 3rd party component.



If you don't have anything extra installed on your machine, I think you're

going to have to use the ADO Stream object to read in binary data and

Response.BinaryWrite() this to the client:

http://msdn.microsoft.com/library/?url=/library/en-us/ado270/htm/mdobjstream

.asp?frame=true



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From: <louis@l...>

Subject: [asp_web_howto] Serving binary files





: I am trying to find out how to write a binary file using

: response.binarywrite. I am working on an image based site and want to

: serve requested images via an asp file.

:

: I have tried the following code which seems to be unable to create the

: server object perhaps because I am missing a component?

:

: <%

:

: Dim Picture

: response.contenttype = "image/jpeg"

: set ObjBin = server.createobject("bin.binary")

: Picture = ObjBin.ReadFile("./test.jpg")

: response.binarywrite(Picture)

: set ObjBin = Nothing

:

: %>

:

: Can anyone tell me how this should be done.

: Perhaps worth a mention is that I am using PWS on win98 so currently can

: only test asp 2 stuff.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Message #3 by "Louis Carresi" <louis@l...> on Thu, 28 Feb 2002 11:05:53 -0000

Yes, I believe it is but the example I got this from fails to tell you where to get it 

other than saying "using a popular third party component ....." :-)



Great! I still haven't got any closer to solving this problem although there are a 

lot of questions on the subject with few real answers. Many of the questions 

deal with using binarywrite with images stored in a database - the last thing I 

want to do is store these images in a database. :-) but of course if you have 

done that they are already stored in binary format so the binarywriting is 

straight forward.



I may just give up on this thing and write the damn thing in Perl. Problem is I 

am not sure if our ISP (about to move to ) has this installed. What I do know is 

that Perl makes this pretty simple.



I have heard some noises on the ADO Stream so I will check this out. Thanks 

for the suggestion Ken.



Best regards



Louis



> I've never heard of the bin.binary component. It's not part of the standard

> IIS/PWS install, and must be a 3rd party component.

> 

> If you don't have anything extra installed on your machine, I think you're

> going to have to use the ADO Stream object to read in binary data and

> Response.BinaryWrite() this to the client:

> http://msdn.microsoft.com/library/?url=/library/en-us/ado270/htm/mdobjstream

> .asp?frame=true

> 

> Cheers

> Ken

> 

> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> From: <louis@l...>

> Subject: [asp_web_howto] Serving binary files

> 

> 

> : I am trying to find out how to write a binary file using

> : response.binarywrite. I am working on an image based site and want to

> : serve requested images via an asp file.

> :

> : I have tried the following code which seems to be unable to create the

> : server object perhaps because I am missing a component?

> :

> : <%

> :

> : Dim Picture

> : response.contenttype = "image/jpeg"

> : set ObjBin = server.createobject("bin.binary")

> : Picture = ObjBin.ReadFile("./test.jpg")

> : response.binarywrite(Picture)

> : set ObjBin = Nothing

> :

> : %>

> :

> : Can anyone tell me how this should be done.

> : Perhaps worth a mention is that I am using PWS on win98 so currently can

> : only test asp 2 stuff.

> 

> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> 

> 









  Return to Index