forked from maxliaops/Java_Web_Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileUtils.java
More file actions
36 lines (30 loc) · 830 Bytes
/
FileUtils.java
File metadata and controls
36 lines (30 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.core;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
/**
* <p>Copyright: Copyright (c) 2008</p>
* <p>Company: MR</p>
* @author wgh
* @version 2.0
*/
public class FileUtils {
public FileUtils() {
}
public static boolean FileDel(HttpServletRequest request ,String path) {
if(path==null) return false;
path=request.getSession().getServletContext().getRealPath(path);
System.out.println(path+" ]path");
File f = new File(path);
if (!f.exists()) {
return false;
} else {
if (f.delete()) {
return true;
}
}
return false;
}
public static void main(String[] args) {
FileUtils fileUtils1 = new FileUtils();
}
}