Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 1st, 2004, 02:18 PM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problems displaying images via a variable

Using the FileSystemObject I'd like for users to specify an image in a folder via a textfield and have that image display in a browser window for them to right click and save to their desktop, upon pressing the submit button. OnSubmit calls the follwing asp page:



***********************************************
<%
Set fso = CreateObject("Scripting.FileSystemObject")
'check for development server
checkfordevserver="\webdev\"
checkfordevserver=Server.MapPath(checkfordevserver )
%>

 <%
dim model
dim modelpic
dim getpic
model=Request.Form("model")

if model<>"" Then
    modelpic="d_"&model&".gif"


Response.Write("<img src=""../../../img/"""&modelpic&""" "">")


end if


%>


This causes a new browser window to open with the following:

<img src="../../../img/"d_HL1435.gif" ">

*************************************************

If I replace the Response.Write values with the following:

Response.Write("<img src=""../../../img/<%=modelpic%> "">")

I get the same results. BUT what I want is that image displays in the browser window for the user to right click and save to his desktop.

Any help would greatly be appreciated.
Thanks


 
Old June 1st, 2004, 04:04 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hello,

It should render the image to the screen. However, I notice that you have some extra " in your src attribute. You have:

<img src="../../../img/"d_HL1435.gif" ">

It should be:

<img src="../../../img/d_HL1435.gif">

The new response.Write line is:

Response.Write("<img src=""../../../img/" & modelpic & """>")

Try that, and let me know,

Brian
 
Old June 2nd, 2004, 02:17 PM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Brian, it work out just like you said!
Thanks again for the help





Similar Threads
Thread Thread Starter Forum Replies Last Post
displaying images chandan121 JSP Basics 0 May 1st, 2008 09:59 PM
Displaying images...... kethireddy435 ASP.NET 2.0 Professional 0 September 16th, 2007 09:25 PM
Displaying Images From Database Metalore BOOK: Beginning ASP.NET 2.0 and Databases 1 November 1st, 2006 11:45 AM
Images not displaying Penn_Clark Dreamweaver (all versions) 3 February 21st, 2006 12:59 PM
Displaying images inbox Classic ASP XML 2 May 4th, 2005 03:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.