[thelist] Hiding image path?

Anthony Baratta Anthony at Baratta.com
Tue Apr 3 11:33:36 CDT 2001


At 08:11 AM 4/3/2001, you wrote:
>Is there a way to hide the image path before or during
>returning an HTML/asp page to the browser?

You can create another script called viewimage.asp and pipe the image name 
via the Query String. I use the SoftArtisan's FIleManager DLL/Component to 
do the binary read and then use binary write to stream it to the browser. 
Just make sure you tell the browser the mime type.

Here's my code: I pass the Image name via the Session Object, modify to 
suit your needs.

<%
     if not isEmpty(Session("TargetImage")) then
         varFileLocation = varFileDir & CStr(Session("TargetImage"))
         Set oFM = CreateObject("SoftArtisans.FileManager")
         Set oBS = oFM.OpenBinaryFile(varFileLocation)
         Response.ContentType = "image/GIF"
         Response.Addheader "Content-Disposition", "inline; filename=" & 
CStr(Session("TargetImage"))
         Response.BinaryWrite oBS.ReadAll

         'Clean up....
         Set oBS = Nothing
         Set oFM = Nothing
         Session("TargetImage") = Empty
     end if
%>
---
Anthony Baratta
President
Keyboard Jockeys





More information about the thelist mailing list