FSO directory listing
G'day,
I have written some code that displays all the files in a directory so that I can then upload or delete files through a web interface. Everything works fine although it seems that I am restricted to having the ASP file in the same folder with the files that I want to manage.
I don't want this because it then lists the actual ASP script file as being a file in the directory which of course I don't want users to be able to see and delete.
I have tried playing around with the Path mappings and I get all sorts of strange error messages. Is anyone able to see what I may be doing wrong from my code below.
Basically, I want to be able to run the script from say c:\script that lists the files in say c:\images and I don't want to have to put the script file in c:\images with the image files.
================================================== =============
The code:
strPathInfo = Request.ServerVariables("SCRIPT_NAME")
strPhysicalPath = Server.MapPath(strPathInfo)
Dim objFSO, objFile, objFileItem, objFolder, objFolderContents
set objFSO = CreateObject("Scripting.FileSystemObject")
set objFile = objFSO.GetFile(strPhysicalPath)
set objFolder = objFile.ParentFolder
Set objFolderContents = objFolder.Files
|