日期:2014-05-17 浏览次数:20718 次
UploadFileServlet.java
?
package com.XXX.xheditor.servlet;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.fileupload.DiskFileUpload;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.lang.StringUtils;
// ?xhEditor文件上传的Java - Servlet实现.
// ?@ author WeiMiao
// ?@ refer to easinchu
// ?@ version 2
// ?@ description 增加html5上传功能的支持
public class UploadFileServlet extends HttpServlet {
?? ?private static final long serialVersionUID = 1541334866883495283L;
?
?? ?private static String baseDir = "/UploadFile/"; // 上传文件存储目录
?? ?private static String fileExt = "jpg,jpeg,bmp,gif,png";
?? ?pri