public String getName()
Returns the name of the file or directory denoted by this abstract pathname. This is just the last name in the pathname's name sequence. If the pathname's name sequence is empty, then the empty string is returned. Returns:
The name of the file or directory denoted by this abstract pathname, or the empty string if this pathname's name sequence is empty

解决方案 »

  1.   

    <script>
    function UpLoadForm_Validator(pUpLoadForm)
    {
    if(document.all.UpLoadFile.value=="")
    {
    window.confirm("请选择上传的文档!");
    pUpLoadForm.UpLoadFile.focus();
    return false;
    }
    var strFileFormat=pUpLoadForm.UpLoadFile.value.match(/^(.*)(\.)(.{1,8})$/)[3];//检查上传文件格式
    strFileFormat=strFileFormat.toUpperCase();
    if(strFileFormat=="DOC"||strFileFormat=="DOT")
    {
    }
    else
    {
    window.confirm("只能上传.Doc和.Dot,请重新选择!");
    return false;
    }
    return true;
    }
    </script>
    <form method="POST" enctype="multipart/form-data" action="" onsubmit="return UpLoadForm_Validator(this)" laguage="JavaScript" name="UpLoadForm">
    <input type="file" name="UpLoadFile" style="visibility:hidden;">
    <input type=button onclick="UpLoadFile.click();">
    <input type="submit" value="上传" name="UpLoadButton">
    </form>
      

  2.   

    Function ShowFolderList(folderspec , folderPath , virturalPath) 
        Dim fso, f, f1, fc, s
        Set fso = CreateObject("Scripting.FileSystemObject")
        if not fso.FolderExists(folderspec) then
          response.write "该目录不存在!"
          response.end
        end if
        Set f = fso.GetFolder(folderspec)
        '----------获得子文件夹----
        Set fc = f.SubFolders
        For Each f1 in fc
            s = s &"<img src='../image/folder.gif'><a href='serdownload.asp?myPath="& folderPath & "\"& f1.name &"'>" & f1.name &"</a>" 
            s = s & "<BR><BR>"
        Next    '-----------获得文件-------
        Set fc = f.Files
        For Each f2 in fc
            s = s &"<img src='../image/"&GetIcon(f2.name)&"'><a href='../download"& folderPath &"/" &f2.name &"'>"& f2.name &"</a>"
            s= s &"&nbsp;("& Round(f2.size/1024000,2) &"M"&")"
            s = s & "<BR>"
        Next  
        ShowFolderList = s    
    End Function
      

  3.   

    你是说java里面的file类还是string?
    如果是file类,可以直接得到filename,有方法的
    如果是string,截字符串吧!最后一个“.”是扩展名,这个“.”前面第一个“\”是文件名,连一起就行了