使用JAVA的JFinal框架

1.上传文件模型类UploadFile

 1 /**
 2  * Copyright (c) 2011-2017, James Zhan 詹波 (jfinal@126.com).
 3  *
 4  * Licensed under the Apache License, Version 2.0 (the "License");
 5  * you may not use this file except in compliance with the License.
 6  * You may obtain a copy of the License at
 7  *
 8  *      http://www.apache.org/licenses/LICENSE-2.0
 9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.jfinal.upload;
18 
19 import java.io.File;
20 
21 /**
22  * UploadFile.
23  */
24 public class UploadFile {
25     
26     private String parameterName;
27     
28     private String uploadPath;
29     private String fileName;
30     private String originalFileName;
31     private String contentType;
32     
33     public UploadFile(String parameterName, String uploadPath, String filesystemName, String originalFileName, String contentType) {
34         this.parameterName = parameterName;
35         this.uploadPath = uploadPath;
36         this.fileName = filesystemName;
37         this.originalFileName = originalFileName;
38         this.contentType = contentType;
39     }
40     
41     public String getParameterName() {
42         return parameterName;
43     }
44     
45     public String getFileName() {
46         return fileName;
47     }
48     
49     public String getOriginalFileName() {
50         return originalFileName;
51     }
52     
53     public String getContentType() {
54         return contentType;
55     }
56     
57     public String getUploadPath() {
58         return uploadPath;
59     }
60     
61     public File getFile() {
62         if (uploadPath == null || fileName == null) {
63             return null;
64         } else {
65             return new File(uploadPath + File.separator + fileName);
66         }
67     }
68 }
model类

相关文章:

  • 2022-01-30
  • 2022-12-23
  • 2021-05-26
  • 2021-11-15
  • 2021-12-01
  • 2022-02-01
  • 2021-08-05
猜你喜欢
  • 2021-11-18
  • 2022-12-23
  • 2021-11-18
  • 2021-09-14
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案