Binary write.

  • Thread starter Fernando Chilvarguer
  • Start date
F

Fernando Chilvarguer

I'm having problems with a simple binary write.
The page is just supposed to write a JPEG back to the browser but the image
does not display (the "X" image shows).
Any help is appreciated. Here's the full code:

<%@LANGUAGE="VBSCRIPT"%>
<%
Response.Expires = 0
Response.Buffer = TRUE
Response.Clear
Response.ContentType = "image/jpeg"
set fso = Server.CreateObject("Scripting.FileSystemObject")
set fl = fso.GetFile("c:\afterWF.jpg")
Response.BinaryWrite fl
%>
 
E

Evertjan.

Fernando Chilvarguer wrote on 21 nov 2003 in
microsoft.public.inetserver.asp.general:
I'm having problems with a simple binary write.
The page is just supposed to write a JPEG back to the browser but the
image does not display (the "X" image shows).
Any help is appreciated. Here's the full code:

<%@LANGUAGE="VBSCRIPT"%>
<%
Response.Expires = 0
Response.Buffer = TRUE
Response.Clear
Response.ContentType = "image/jpeg"
set fso = Server.CreateObject("Scripting.FileSystemObject")
set fl = fso.GetFile("c:\afterWF.jpg")
Response.BinaryWrite fl
%>

No rights on reading c:\ ?
 
F

Fernando Chilvarguer

The Internet Guest Account has full rights for that file (read, write,
etc..) When testing, I added the "response.write(fl.Name)" line and it
displayed the file name. Making me assume that the file is being read into
the fl object correctly.
 
E

Evertjan.

Fernando Chilvarguer wrote on 21 nov 2003 in
microsoft.public.inetserver.asp.general:
The Internet Guest Account has full rights for that
file (read, write, etc..) When testing, I added the
"response.write(fl.Name)" line and it displayed the
file name. Making me assume that the file is being
read into the fl object correctly.

Fernando, it was just a suggestion.

[Please do not bottomquote on usenet]
 
R

Ray at

[overquoting because I believe in it]
I think that you might be better off using an ADODB stream than the FSO for
binary files. Code like so:

<%
Response.ContentType = "image/jpeg"
Set oStream = Server.CreateObject("ADODB.Stream")
Response.BinaryWrite oStream.LoadFromFile("C:\afterWF.jpg").Read
oStream.Close : Set oStream = Nothing
%>

Ray at work




Fernando Chilvarguer said:
The Internet Guest Account has full rights for that file (read, write,
etc..) When testing, I added the "response.write(fl.Name)" line and it
displayed the file name. Making me assume that the file is being read into
the fl object correctly.
 
F

Fernando Chilvarguer

It worked!!!!

Thanks!!

PS: I had to add oStream.Open before loading from the file

Ray at said:
[overquoting because I believe in it]
I think that you might be better off using an ADODB stream than the FSO for
binary files. Code like so:

<%
Response.ContentType = "image/jpeg"
Set oStream = Server.CreateObject("ADODB.Stream")
Response.BinaryWrite oStream.LoadFromFile("C:\afterWF.jpg").Read
oStream.Close : Set oStream = Nothing
%>

Ray at work
 
E

Evertjan.

Ray at said:
[overquoting because I believe in it]

Ray, you are so important to this NG and your conviction is well known,
I won't quarrel with you about that.

==========================

But then sci.lang.translation taught me that:

overquoting = quoting to much, [and you do not]
underquoting = quoting not enough

topquoting = bottomposting
bottomquoting = topposting
interquoting = interposting
 
R

Ray at

Ray, you are so important to this NG and your conviction is well known,
I won't quarrel with you about that.

Aw, shucks... Thanks Evertjan.
But then sci.lang.translation taught me that:

overquoting = quoting to much, [and you do not]
underquoting = quoting not enough

Damn web-based usenet access.

topquoting = bottomposting
bottomquoting = topposting
interquoting = interposting

I like that list of terms. Thanks. Interquoting would be my quoting of
choice, I suppose.

Ray at work
 

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
474,141
Messages
2,570,814
Members
47,358
Latest member
AlexSon

Latest Threads

Top