//根据文件路径截取文件名
 
 public String getfileName(String s) throws Exception{
         s.trim();     
        String fileName = s.substring(s.lastIndexOf("/")+1);    
        //或者   
        String fileName = s.substring(s.lastIndexOf("\\")+1);  
        System.out.println("fileName = " + fileName);
        return fileName;
 }

参考文章:

http://rogerfederer.iteye.com/blog/1039666