asp server.mappath help?

gagan

New member
i am making a website. it is asp. it is in the "cheese" folder located in wwwroot folder.
in folder CHEESE i have a file games.asp which has to load the names of the games placed in the FLASHGAMES folder placed in the CHEESE folder.
how to do it so that it automatically updates itself

that is using the server.mappath method and folder.files somewhat like that
 
Assuming that the root level of your website is the folder CHEESE:


Place this code in your file games.asp located in the CHEESE FOLDER and it will list out the names of the games found in FLASHGAMES FOLDER.

<%
Dim GamesFSO, GamesFile, GamesFolder

Set GamesFSO = Server.CreateObject("Scripting.FileSystemObject")
Set GamesFolder = GamesFSO.GetFolder(Server.MapPath("/FLASHGAMES"))

For Each GamesFile in GamesFolder.Files
Response.Write GamesFile.Name & "<br>"
Next
Set GamesFolder = Nothing
Set GamesFSO = Nothing
%>

Please note:
due to incomplete code display in the answer area,

Scripting.FileSyste… = Scripting.FileSystemObject")

and

MapPath("/FLAS… = MapPath("/FLASHGAMES"))
 
Back
Top