用的是java实现的 没用到别的技术 也不用连接数据库的
index.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="js/uploadify/uploadify.css"/>
<script type="text/javascript" src="js/uploadify/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/uploadify/swfobject.js"></script>
<script type="text/javascript" src="js/uploadify/jquery.uploadify.v2.1.4.js"></script>
<title>upload上传文件</title>
<script type="text/javascript">
$(document).ready(function(){
$('#uploadify').uploadify({
'uploader' : 'js/uploadify/uploadify.swf',//上传控件的主体文件,flash控件默认值='uploadify.swf'
'script' : 'Upload',//相对路径的后端脚本,它将处理上传的文件
'cancelImg' : 'js/uploadify/cancel.png',//取消按钮。设定图片路径
'folder' : 'upload',//将文件保存到的路径
'muti' : true,// 是否允许同时上传多文件,可设定true或false
'auto' : false,//选定文件后是否自动上传,可设定true或false, 默认false
'fileExt' : '*.avi;*.swf;*.flv;*.wmv',//支持的格式,启用本项时需同时声明fileDesc
'fileDesc' : '视频格式(.avi, .swf, .flv, .wmv)',//出现在上传对话框中的文件类型描述。与fileExt需同时使用
'queueID' : 'fileQueue',// 文件队列ID。与div的id一致
'queueSizeLimit': 3,//可以一次选定几个文件
'simUploadLimit': 3,// 一次可传几个文件
'removeCompleted': false
});
});
</script>
</head>
<body>
<div id="fileQueue">
<input type="file" name="uploadify" id="uploadify" />
<a href="javascript:jQuery('#uploadify').uploadifyUpload()">开始上传</a>&nbsp;
<a href="javascript:jQuery('#uploadify').uploadifyClearQueue()">取消所有上传</a>
</div>
</body>
</html>Upload.java :
public class Upload extends HttpServlet {
    @SuppressWarnings("unchecked")
    public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
        String savePath = this.getServletConfig().getServletContext().getRealPath("");
        savePath = savePath + "/upload/";
        File f1 = new File(savePath);
        System.out.println(savePath);
        if (!f1.exists()) {
            f1.mkdirs();
        }
        DiskFileItemFactory fac = new DiskFileItemFactory();
        ServletFileUpload upload = new ServletFileUpload(fac);
        upload.setHeaderEncoding("utf-8");
        List fileList = null;
        try {
            fileList = upload.parseRequest(request);
        } catch (FileUploadException ex) {
            return;
        }
        Iterator<FileItem> it = fileList.iterator();
        String name = "";
        String extName = "";
        while (it.hasNext()) {
            FileItem item = it.next();
            if (!item.isFormField()) {
                name = item.getName();
                long size = item.getSize();
                String type = item.getContentType();
                System.out.println(size + " " + type);
                if (name == null || name.trim().equals("")) {
                    continue;
                }
                //扩展名格式:
                if (name.lastIndexOf(".") >= 0) {
                    extName = name.substring(name.lastIndexOf("."));
                }
                File file = null;
                do {
                 //生成文件名:
                    name = UUID.randomUUID().toString();
                    file = new File(savePath + name + extName);
                } while (file.exists());
                File saveFile = new File(savePath + name + extName);
                try {
                    item.write(saveFile);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
        response.getWriter().print(name + extName);
    }
}
用的是jquery.uploadify.v2.1.4.js的版本
现在遇到的问题是:
1.把muti设置为true多文件上传没用,只能一个一个的上传!
请高手告诉我要改哪里,说的详细点!