DMXzone’s Pure ASP Upload is one of the best Tools I have for creating dynamic web sites. I’ve been using it over ten years. But there’s never really enough? Is there? Dreamweaver is a great tool for creating dynamic website, but if you want to get the most out of Dreamweaver and tools like DMXzone Pure ASP Upload, you have to reach under the hood and get your hands dirty by fine-tuning your code. With a little hand coding, however, there is no reason your applications cannot be as powerful and feature packed as any available.
Bonus: Displaying Images Using the File Scripting Object
Earlier in this tutorial I mentioned using the file scripting object to prevent the dreaded red X when displaying and image. This is the method I use. Notice that I close the ASP script block before the image tag and start a new script for the closing End If. If you do it this way Dreamweaver will display the image placeholder in design view. If you put it all in one script block and use the Response.Write() method to display the image you will not see the image placeholder in design view.
<%Set objFileSystem = Server.CreateObject("Scripting.FileSystemObject")
objFile = Request.ServerVariables("SCRIPT_NAME")
ImageFolder = Server.MapPath("../site_images\")
ImagePath = ImageFolder & "\" & (rs_links.Fields.Item("Link_Image").Value)
If objFileSystem.FileExists(ImagePath) then%>
<a href="http://<%=(rs_links.Fields.Item("Link_URL").Value)%>" target="_blank">
<img src="../site_images/<%=(rs_links.Fields.Item("Link_Image").Value) %>" hspace="5" vspace="5" border="0" alt="Link Image" /></a>
That's all there is to it. In this tutorial you learned how to toggle the skip empty fields feature of Pure ASP Upload, and how to delete the image using the file scripting object to access the server's file system. In the next part of this series, "Taking it to the Limit with Pure ASP Upload 3.0." we will learn how to handle multiple images and sequential images using the For… Each loop. You also learned to prevent the red X of missing images on your site front end using the file scripting object.