用javascript不可能。
用FSO可以得到目录和文件名,但不能上传文件。
建议用专用的上传组件。

解决方案 »

  1.   

    <script language="vbscript">
    Dim fso
    Dim TabStop
    Dim NewLine
    NewLine = ""
    TabStop = ""
    Set fso = CreateObject("Scripting.FileSystemObject")Dim strRootDoc
    Dim html
    html= ""
    getFolderList fso.GetFolder("d:\"),html,0document.write html
    '&cedil;&oslash;&sup3;&ouml;&Ograve;&raquo;&cedil;&ouml;&Icirc;&Auml;&frac14;&thorn;&frac14;&ETH;&pound;&not;&Aacute;&ETH;&sup3;&ouml;&AElig;&auml;&Iuml;&Acirc;&micro;&Auml;&Euml;ù&Oacute;&ETH;&Icirc;&Auml;&frac14;&thorn;&frac14;&ETH;
    Function getFolderList(oFolder,html,n)
    Dim a
    Dim tmp
    tmp=""
    Dim i
    Dim strRootPath
    For i = 1 To n
    tmp=tmp & "&nbsp;&nbsp;"
    Next
    html = html & "<div id=""mxh" & n & """>"
    For Each a In oFolder.SubFolders
    'html = html & "<div><img src=""DocTypeIcons/folder16.gif"" align=absmiddle>&nbsp;<a href='Javascript:void(null)'>" & a.Name & "</a></div>" & chr(13)
    html = html & "<div>" & tmp & "<img src=""DocTypeIcons/folder16.gif"" align=absmiddle>&nbsp;<a href='Javascript:void(null)'>" & a.Name & "</a></div>" & chr(13) If a.SubFolders.Count>0 Then
    getFolderList a,html,n+1
    End If
    Next
    html = html & "</div>"
    End Function</script>
      

  2.   

    以上是列目录,下面是文件<script language="vbscript">
    Dim fso,f
    Set fso = CreateObject("Scripting.FileSystemObject")
    Dim html
    html= ""
    getFolderList fso.GetFolder("d:\"),html,0
    document.write html
    '&cedil;&oslash;&sup3;&ouml;&Ograve;&raquo;&cedil;&ouml;&Icirc;&Auml;&frac14;&thorn;&frac14;&ETH;&pound;&not;&Aacute;&ETH;&sup3;&ouml;&AElig;&auml;&Iuml;&Acirc;&micro;&Auml;&Euml;ù&Oacute;&ETH;&Icirc;&Auml;&frac14;&thorn;&frac14;&ETH;
    Function getFolderList(oFolder,html,n)
    Dim a
    Dim tmp
    tmp=""
    Dim i
    For i = 1 To n
    tmp=tmp & "&nbsp;&nbsp;"
    Next
    html = html & "<div id=""mxh" & n & """>"
    For Each a In oFolder.SubFolders
    Set f = fso.GetFolder(a.Path)
         Set fc = f.Files
         For each ff In fc
    html = html & ff.Name & "<br>"
    Next
    If a.SubFolders.Count>0 Then
    getFolderList a,html,n+1
    End If
    Next
    html = html & "</div>"
    End Function</script>