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 August 7th, 2003, 06:13 AM
Authorized User
 
Join Date: Aug 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ells228
Default Show files in a folder and ability to select

Following on from the folder creation, i wanted to have it so the user could see the list of files in the property folder and select the file to update the link in the db.

There are a possibility of 3 image paths they can update in the db, so i designed one page to handle this, instead of 3 seperates by passing the field name from a hidden field in the form

This is what i did:

Show Files Page
<%
' File System Object
PropFolder = request("Property")
Image = Request("Image") 'db field name

Dim fso
Set fso = Server.CreateObject("Scripting.FileSystemObject")

' "Uploaded" Folder
Dim folder
Set folder = fso.GetFolder(Server.MapPath("../images/properties/" & PropFolder))

If folder.Size > 0 Then
Response.Write "Files for Property <b>" & PropFolder & "</b>"
Response.Write "[list]"
For Each file In folder.Files
Response.Write "<li type=""circle"">"
Response.Write "<a href='updateimage.asp?Property=" & PropFolder & "&Image=" & Image & "&file="
Response.Write file.Name & "'>"
Response.Write "<b>" & file.Name
Response.Write "</b></a> "
'Response.Write "( Size: " & file.Size & " ) "
Next
Response.Write "</ul>"
Response.Write "Click a file to select it"
Else
Response.Write "[list]<li type=""circle"">No Files Uploaded.</ul>"
End If
%>


Update Image Page
<%
PropFolder = request("Property")
UpdateImage = Request("Image")
filename = Request("file")

strsql = "UPDATE Properties SET " & UpdateImage & "= '../images/properties/" & PropFolder & "/" & filename & _
         "'WHERE PropertyRef like '" & PropFolder & "'"

rsuser.open strsql,conn,1,2

response.redirect("updateprop.asp?property=" & PropFolder)
%>
__________________
Cheers,
C.

Chris Ellis
Icon-Business Ltd
www.icon-business.net
[email protected]





Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving files from one folder to another sachtaridis C# 1 November 23rd, 2007 04:33 AM
how can i select any folder/file through webpage hemaneelagiri ASP.NET 1.0 and 1.1 Professional 2 March 23rd, 2006 12:54 AM
Within a SELECT do 2 Sum and show only 1 Ford SQL Server 2000 2 November 8th, 2005 01:21 AM
FILES in FOLDER luma SQL Server DTS 0 June 9th, 2005 01:53 AM
problem with insert, on select data doesn't show pascalgeuze ADO.NET 1 April 24th, 2004 01:50 AM





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