flyclassic22
Technical User
Hi, I've this current script(ASP) that need modification which i've stucked.
My current script work this way, whenever my webpage starts it will go into a specific folder and search for extention ".xml" files and will list them out in a drop down list.
<%
Private Function getFilesByType(strFolder, strType)
'getFilesByType
' returns an Array of files for a specific type in a folder
' if no files where found returns null
Dim objFSO, objFolder, fileItem, fileCollection, arrFiles, i
Set objFSO = Server.CreateObject("Scripting.FileSystemObject"
Set objFolder = objFSO.GetFolder(strFolder)
Set fileCollection = objFolder.Files
response.write("<select name=""xmlfileid"" onclick=""showpreview_brief(selection.xmlfileid.value)"">"
i = 0
For Each fileItem in fileCollection
If (lCase(Right(fileItem.name, len(fileItem.name) - InStr(fileItem.name, ".")) = lCase(strType)) Then
If (i <> 0) Then
arrFiles = arrFiles & ";"
End If
i = i + 1
response.write("<option value=""xmldata/" &fileItem.name &""">" &fileItem.name)
'arrFiles = arrFiles & fileItem.name
End If
Next
Set objFSO = Nothing
Set objFolder = Nothing
Set fileCollection = Nothing
If (isNull(arrFiles) Or arrFiles = "" Then
getFilesByType = Null
Else
getFilesByType = Split(arrFiles, ";"
End If
response.write("</select>"
End Function
getFilesByType server.mappath("/MyProj/xmldata", "xml"
%>
However, i wanted to add another drop down list beside to allow user to select a specfic web server directory (for exame /MyProj/A/xmldata/ , /MyProj/B/xmldata/)
before it will display the xml drop down list with a list of the xml files. Meaning, user can select a directory from a drop down list and it wil automatically create another drop down list listing their xml files, in other words dynamic. I'm very confused as how to implement it into my current script. Can anybody help me solve?
My current script work this way, whenever my webpage starts it will go into a specific folder and search for extention ".xml" files and will list them out in a drop down list.
<%
Private Function getFilesByType(strFolder, strType)
'getFilesByType
' returns an Array of files for a specific type in a folder
' if no files where found returns null
Dim objFSO, objFolder, fileItem, fileCollection, arrFiles, i
Set objFSO = Server.CreateObject("Scripting.FileSystemObject"
Set objFolder = objFSO.GetFolder(strFolder)
Set fileCollection = objFolder.Files
response.write("<select name=""xmlfileid"" onclick=""showpreview_brief(selection.xmlfileid.value)"">"
i = 0
For Each fileItem in fileCollection
If (lCase(Right(fileItem.name, len(fileItem.name) - InStr(fileItem.name, ".")) = lCase(strType)) Then
If (i <> 0) Then
arrFiles = arrFiles & ";"
End If
i = i + 1
response.write("<option value=""xmldata/" &fileItem.name &""">" &fileItem.name)
'arrFiles = arrFiles & fileItem.name
End If
Next
Set objFSO = Nothing
Set objFolder = Nothing
Set fileCollection = Nothing
If (isNull(arrFiles) Or arrFiles = "" Then
getFilesByType = Null
Else
getFilesByType = Split(arrFiles, ";"
End If
response.write("</select>"
End Function
getFilesByType server.mappath("/MyProj/xmldata", "xml"
%>
However, i wanted to add another drop down list beside to allow user to select a specfic web server directory (for exame /MyProj/A/xmldata/ , /MyProj/B/xmldata/)
before it will display the xml drop down list with a list of the xml files. Meaning, user can select a directory from a drop down list and it wil automatically create another drop down list listing their xml files, in other words dynamic. I'm very confused as how to implement it into my current script. Can anybody help me solve?