BinaryWrite Problem

K

Kevin Humphreys

Hi All,

Please help me regarding the 'Response.BinaryWrite' I am making one web
application where I need to store some of client logo's and others images.
In this context I am able to store images into .DB file and even able to
display into browser to. But it seems to be 'Response.BinaryWrite' does not
support 'html/text' hearder if you user 'BinaryWrite'? I had tried many way
to do so but its does not write binary if pages content <html><body> tag's.

I could had done it by uploading images into disk, which is quite simple
method and faster too<img src"images/<%=filename%>.jpg/gif"> by having
unique file name. But I am not the person who is going to monitor it as
user itself has a persmission through the web to have there image as they
want to give file name etc. Also I can't have individual directory for each
users as if tomorrow users grow then what I suppose to do?

Thanks,
Kevin.
 
K

Ken Schaefer

Hi,

If you want to display a webpage *and* an image, then you need to:

a) Response.Write() the HTML page, so that it contains a HTML <img> tag. You
point the src="" attribute to a special ASP page on your server, eg:

<img src="getImage.asp?ImageID=1">

b) getImage.asp retrieves the image data and Response.BinaryWrite() it to
the client using the appropriate content type for the image, eg image/gif or
image/jpg. An image is *not* text/html - that's for the HTML page.

Remember you have to do this the way way a normal HTML page works. First the
browser downloads the HTML page - then it looks for <img> tags, and it
downloads the images separately. Each image request is a separate request.
Each request needs an appropriate response from the server, with the correct
ContentType.

Cheers
Ken

: Hi All,
:
: Please help me regarding the 'Response.BinaryWrite' I am making one web
: application where I need to store some of client logo's and others images.
: In this context I am able to store images into .DB file and even able to
: display into browser to. But it seems to be 'Response.BinaryWrite' does
not
: support 'html/text' hearder if you user 'BinaryWrite'? I had tried many
way
: to do so but its does not write binary if pages content <html><body>
tag's.
:
: I could had done it by uploading images into disk, which is quite simple
: method and faster too<img src"images/<%=filename%>.jpg/gif"> by having
: unique file name. But I am not the person who is going to monitor it as
: user itself has a persmission through the web to have there image as they
: want to give file name etc. Also I can't have individual directory for
each
: users as if tomorrow users grow then what I suppose to do?
:
: Thanks,
: Kevin.
:
:
 

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

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top