@SuppressWarnings("unchecked")
	private void upload(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String message = "";
		int maxlen = 1024 * 1024 * 50;  //ļΪ 50MB
		String filedir = getServletContext().getRealPath("/files"); // ļ浽ϵ·
		System.out.println("ļ浽ϵ·filedir--" + filedir);
		FileXLoad myxload = new FileXLoad(); // ʵFileXLoad
		myxload.init(request, response, filedir);
		myxload.setMaxlen(maxlen); // ļĴС
		boolean start = myxload.upload(); // ļϴķ

		if (start) {
			List files = myxload.getFiles();
			//жļǷ
			if (files != null && files.size() != 0) {
				Date date = new Date();
				FileDao fileDao = new FileDao();
				Parameters params = myxload.getParams();
				for (int i = 0; i < files.size(); i++) {
					File file = (File) files.get(i);
					//жļǷЧ
					if (file.isAvailable()) {
						String filepath = file.getFilePath(); // ȡļ·
						String fileinfo = params.getFieldValue("fileinfo"
								+ (i + 1)); // ȡļ
						
						// ȡļ浽ݿ
						// file.getFileExt():ļչ"."ַ
						String savename = StringHandler.getSerial(date, i)
								+ file.getFileExt();
						System.out.println(savename + "---savename---"
								+ file.getFileExt());
						String filename = file.getFileName(); // ȡϴļ
						String filetype = file.getFileType(); // ȡϴļ
						int filesize = file.getFileSize(); // ȡϴļĴС
						String uptime = StringHandler.timeTostr(date); // ȡļϴʱ

						FileBean filebean = new FileBean();
						filebean.setFilePath(filepath);
						filebean.setFileName(filename);
						filebean.setSaveName(savename);
						filebean.setFileType(filetype);
						filebean.setFileSize(filesize);
						filebean.setFileInfo(fileinfo);
						filebean.setUptime(uptime);

						int k = fileDao.addFileInfo(filebean); // ļϢݿ
						if (k <= 0)
							message += " ļ <b><font color='red'>"
									+ file.getFilePath()
									+ "</font></b> ϴʧܣ<br>";
						else {
							//filedir浽ϵ·
							//savename浽ϵļ
							boolean savetodisk = file.saveFileToDisk(filedir,
									savename); // ļ
							if (savetodisk)
								message += " ļ <b><font color='red'>"
										+ file.getFilePath()
										+ "</font></b> ϴɹ<br>";
							else
								message += " ļ <b><font color='red'>"
										+ file.getFilePath()
										+ "</font></b> ϴʧܣ<br>";
						}
					} else
						message += " ļ <b><font color='red'>"
								+ file.getFilePath()
								+ "</font></b> ЧСΪ0<br>";
				}
				fileDao.closed();
			} else
				message += " ѡһҪϴļѡļСΪ0<br>";
		} else
			message = myxload.getMessage();

		message += "<br>>> <a href='uploadfile.jsp'></a>";
		message += "<br>>> <a href='index.jsp'>ҳ</a>";

		request.setAttribute("message", message);
		RequestDispatcher rd = request.getRequestDispatcher("/message.jsp");
		rd.forward(request, response);
	}