资源简介
大家千万不要下载那个四分的那个,都是16年以前的文件,我把CSDN能下载的uimaker模板都下载下来了!做成了合集,要psd的给我信息吧!压缩包里上直接能用的模板文件,包括手机的版本也在!
代码片段和文件信息
package com.baidu.ueditor.um;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.*;
import org.apache.commons.fileupload.*;
import org.apache.commons.fileupload.FileUploadbase.InvalidContentTypeException;
import org.apache.commons.fileupload.FileUploadbase.SizeLimitExceededException;
import org.apache.commons.fileupload.util.*;
import org.apache.commons.fileupload.servlet.*;
import org.apache.commons.fileupload.FileItemIterator;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import sun.misc.base64Decoder;
import javax.servlet.http.HttpServletRequest;
/**
* UEditor文件上传辅助类
*
*/
public class Uploader {
// 输出文件地址
private String url = ““;
// 上传文件名
private String fileName = ““;
// 状态
private String state = ““;
// 文件类型
private String type = ““;
// 原始文件名
private String originalName = ““;
// 文件大小
private long size = 0;
private HttpServletRequest request = null;
private String title = ““;
// 保存路径
private String savePath = “upload“;
// 文件允许格式
private String[] allowFiles = { “.rar“ “.doc“ “.docx“ “.zip“ “.pdf““.txt“ “.swf“ “.wmv“ “.gif“ “.png“ “.jpg“ “.jpeg“ “.bmp“ };
// 文件大小限制,单位KB
private int maxSize = 10000;
private HashMap errorInfo = new HashMap();
public Uploader(HttpServletRequest request) {
this.request = request;
HashMap tmp = this.errorInfo;
tmp.put(“SUCCESS“ “SUCCESS“); //默认成功
tmp.put(“NOFILE“ “未包含文件上传域“);
tmp.put(“TYPE“ “不允许的文件格式“);
tmp.put(“SIZE“ “文件大小超出限制“);
tmp.put(“ENTYPE“ “请求类型ENTYPE错误“);
tmp.put(“REQUEST“ “上传请求异常“);
tmp.put(“IO“ “IO异常“);
tmp.put(“DIR“ “目录创建失败“);
tmp.put(“UNKNOWN“ “未知错误“);
}
public void upload() throws Exception {
boolean isMultipart = ServletFileUpload.isMultipartContent(this.request);
if (!isMultipart) {
this.state = this.errorInfo.get(“NOFILE“);
return;
}
DiskFileItemFactory dff = new DiskFileItemFactory();
String savePath = this.getFolder(this.savePath);
dff.setRepository(new File(savePath));
try {
ServletFileUpload sfu = new ServletFileUpload(dff);
sfu.setSizeMax(this.maxSize * 1024);
sfu.setHeaderEncoding(“utf-8“);
FileItemIterator fii = sfu.getItemIterator(this.request);
while (fii.hasNext()) {
FileItemStream fis = fii.next();
if (!fis.isFormField()) {
this.originalName = fis.getName().substring(fis.getName().lastIndexOf(System.getProperty(“file.separator“)) + 1);
if (!this.checkFileType(this.originalName)) {
this.state = this.errorInfo.get(“TYPE“);
continue;
}
this.fileName = this.getName(this.originalName);
this.type = this.getFileExt(this.fileName);
this.url = savePath + “/“ + this.fileName;
BufferedInputStream in = new BufferedInputStream(fis.openStream());
File file = new File(this.getPhysicalPath(this.url));
FileOutputStream out = new FileOutputStream( file );
BufferedOutputStream output = new BufferedOutputStream(out);
Streams.copy(in outpu
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1838 2016-05-28 23:11 webg\custom\demo\accordion\actions.html
文件 1595 2016-05-28 23:11 webg\custom\demo\accordion\ajax.html
文件 1978 2016-05-08 10:51 webg\custom\demo\accordion\basic.html
文件 1416 2016-05-08 10:51 webg\custom\demo\accordion\datagrid_data1.json
文件 1370 2016-05-28 23:11 webg\custom\demo\accordion\expandable.html
文件 1304 2016-05-28 23:11 webg\custom\demo\accordion\fluid.html
文件 2086 2016-05-28 23:11 webg\custom\demo\accordion\multiple.html
文件 2319 2016-05-28 23:11 webg\custom\demo\accordion\tools.html
文件 685 2016-05-08 10:51 webg\custom\demo\accordion\_content.html
文件 2621 2016-05-02 23:22 webg\custom\demo\button.html
文件 6148 2016-05-26 23:43 webg\custom\demo\calendar\.DS_Store
文件 645 2016-05-02 23:22 webg\custom\demo\calendar\basic.html
文件 1391 2016-05-02 23:22 webg\custom\demo\calendar\custom.html
文件 870 2016-05-02 23:22 webg\custom\demo\calendar\disabledate.html
文件 1018 2016-05-02 23:22 webg\custom\demo\calendar\firstday.html
文件 919 2016-05-02 23:22 webg\custom\demo\calendar\fluid.html
文件 642 2016-05-02 23:22 webg\custom\demo\calendar.html
文件 8196 2016-05-29 20:05 webg\custom\demo\datagrid\.DS_Store
文件 1426 2016-05-02 23:22 webg\custom\demo\datagrid\aligncolumns.html
文件 1266 2016-05-02 23:22 webg\custom\demo\datagrid\basic.html
文件 5012 2016-05-02 23:22 webg\custom\demo\datagrid\cacheeditor.html
文件 3646 2016-05-02 23:22 webg\custom\demo\datagrid\cellediting.html
文件 1491 2016-05-02 23:22 webg\custom\demo\datagrid\cellst
文件 1863 2016-05-02 23:22 webg\custom\demo\datagrid\checkbox.html
文件 5245 2016-05-02 23:22 webg\custom\demo\datagrid\clientpagination.html
文件 1346 2016-05-02 23:22 webg\custom\demo\datagrid\columngroup.html
文件 2335 2016-05-10 21:11 webg\custom\demo\datagrid\complextoolbar.html
文件 2305 2016-05-02 23:22 webg\custom\demo\datagrid\contextmenu.html
文件 1743 2016-05-02 23:22 webg\custom\demo\datagrid\custompager.html
文件 1416 2016-05-02 23:22 webg\custom\demo\datagrid\datagrid_data1.json
............此处省略2571个文件信息
评论
共有 条评论