文件上传后台解说

File pathFile = new File(path);
//文件以及路径是否存在
if (!pathFile.exists()) {
//mkdirs可以创建指定目录以及所有的父目录,不存在则创建

pathFile.mkdirs();
}

 

 

substring(参数)是java中截取字符串的一个方法

只定字符串最后出现的位置,从0开始
System.out.println("abcde".lastIndexOf("c")); 输出2
System.out.println("abcdec".lastIndexOf("c")); 输出5

 

posted @ 2017-08-04 11:30  来自IT国的猴子  阅读(128)  评论(0编辑  收藏  举报