不是用来上传文件,而是用来保存文件到本地,所以应该不能用<input type=file>吧,有控件可以实现吗?

解决方案 »

  1.   

    <OBJECT id="fileDialog" codeBase="http://activex.microsoft.com/controls/vb5/comdlg32.cab"
    height="0px" width="0px" classid="clsid:F9043C85-F6F2-101A-A3C9-08002B2F49FB" VIEWASTEXT>
    <PARAM NAME="_ExtentX" VALUE="847">
    <PARAM NAME="_ExtentY" VALUE="847">
    <PARAM NAME="_Version" VALUE="393216">
    <PARAM NAME="CancelError" VALUE="0">
    <PARAM NAME="Color" VALUE="0">
    <PARAM NAME="Copies" VALUE="1">
    <PARAM NAME="DefaultExt" VALUE="">
    <PARAM NAME="DialogTitle" VALUE="">
    <PARAM NAME="FileName" VALUE="">
    <PARAM NAME="Filter" VALUE="">
    <PARAM NAME="FilterIndex" VALUE="0">
    <PARAM NAME="Flags" VALUE="0">
    <PARAM NAME="FontBold" VALUE="0">
    <PARAM NAME="FontItalic" VALUE="0">
    <PARAM NAME="FontName" VALUE="">
    <PARAM NAME="FontSize" VALUE="8">
    <PARAM NAME="FontStrikeThru" VALUE="0">
    <PARAM NAME="FontUnderLine" VALUE="0">
    <PARAM NAME="FromPage" VALUE="0">
    <PARAM NAME="HelpCommand" VALUE="0">
    <PARAM NAME="HelpContext" VALUE="0">
    <PARAM NAME="HelpFile" VALUE="">
    <PARAM NAME="HelpKey" VALUE="">
    <PARAM NAME="InitDir" VALUE="">
    <PARAM NAME="Max" VALUE="0">
    <PARAM NAME="Min" VALUE="0">
    <PARAM NAME="MaxFileSize" VALUE="260">
    <PARAM NAME="PrinterDefault" VALUE="1">
    <PARAM NAME="ToPage" VALUE="0">
    <PARAM NAME="Orientation" VALUE="1">
    </OBJECT>
      

  2.   

    fileDialog.ShowOpen();
    fileDialog.ShowSave()
      

  3.   

    正好前几天写了一个。
    (用了CommonDialog控件,我的机子上(Win2K,vb6)测试通过)<object classid="clsid:F9043C85-F6F2-101A-A3C9-08002B2F49FB" id="CommonDialog1" width="0" height="0"></object>
    <form>
      <p>
      <select name="Select1" size="2" style="width:400;height:150;">
      <option value=""></option>
      </select>
      <br>
      选择的文件共:<input name="Text1" size="3" readOnly value="0">个
      <input type="button" value=" 选择文件... " name="B3" onclick="VBScript:SelectMutipleFiles">
      </p>
    </form>
    <script language="VBScript">
    Function NewOption(s)
        set NewOption = document.createElement("Option")
        NewOption.text  = s
        NewOption.value = s
    End Function
    Sub SelectMutipleFiles
        With CommonDialog1
            .DialogTitle = "选择您要上传的文件"
            .FileName = ""            '清空原来的选择
            .MaxFileSize = 1024 * 4   '存储文件名字符串所需内存
            .Flags = &H200 + &H80000  '允许多选,允许长文件名
            .Filter="所有文件(*.*)|*.*|老崔文件(*.cxp)|*.cxp|文本文件(*.txt)|*.txt"
            .ShowOpen
        End With
        document.forms(0).Select1.options.length = 0
        document.forms(0).Text1.value = 0
        dim FileNames, I
        FileNames = Split(CommonDialog1.FileName, Chr(0))
        document.forms(0).Text1.value = (UBound(FileNames)+1)
        If UBound(FileNames)=0 Then
                document.forms(0).Select1.options.add  NewOption(FileNames(I))
        Else
            For I=1 To UBound(FileNames)
                FileNames(I)=FileNames(0) & "\" & FileNames(I)
                document.forms(0).Select1.options.add  NewOption(FileNames(I))
            Next
        End if
    End Sub
    </script>