ZKM128
asked on
How to display image on ASP from ADODB.Stream object
Hello,
I need to show images on my ASP. Due to the security reasons, I cannot simply put all of my images in the images folder in my website folder and I need to put them outside of my website folder.
For example, my website folder is located at: C:\Inetpub\wwwroot\mysite\
But I need to put images (which I want to show on my web pages) at: C:\images\
I am trying to use ADODB.stream object to pull the images from C:\Images folder and display the image on my ASP using ASP vb codes as shown below
Name of this ASP: ReadImage.asp
I also tried creating another ASP named "DisplayImage.asp" and used the following code to display the image on this page but,
when I launch this page, the page cannot display the image either.
Please explain how to change this code to make it work.
Thank you.
I need to show images on my ASP. Due to the security reasons, I cannot simply put all of my images in the images folder in my website folder and I need to put them outside of my website folder.
For example, my website folder is located at: C:\Inetpub\wwwroot\mysite\
But I need to put images (which I want to show on my web pages) at: C:\images\
I am trying to use ADODB.stream object to pull the images from C:\Images folder and display the image on my ASP using ASP vb codes as shown below
Name of this ASP: ReadImage.asp
<%
Response.ContentType = "image/png"
Set adoStream = Server.CreateObject("ADODB.Stream")
adoStream.Open
adoStream.Type = 1
FPath = "C:\images\1.png"
adoStream.LoadFromFile FPath
Response.BinaryWrite adoStream.Read
adoStream.Close
Set adoStream = Nothing
Response.End
%>
When I launch this webpage in internet explorer, the page shows a File Download window/message for downloading the image file "1.png" rather than displaying the image on the web page.I also tried creating another ASP named "DisplayImage.asp" and used the following code to display the image on this page but,
<img src="ReadImage.asp">
when I launch this page, the page cannot display the image either.
Please explain how to change this code to make it work.
Thank you.
Why not just create a virtual directory in IIS? Is that an option?
ASKER
I don't know how to do this by creating virtual directory. Could you please explain to me in detail how to do it by using virtual directory in IIS?
ASKER
Thanks for your help but the example at:
http://www.chilkatsoft.com/p/p_271.asp
doesn't seem to explain how to display the image file on the web page (html or asp) but just explains how to stream and download files.
http://www.chilkatsoft.com/p/p_271.asp
doesn't seem to explain how to display the image file on the web page (html or asp) but just explains how to stream and download files.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.