標籤:throws char 檔案 width position uid lis lin footer
近期在論壇中看到。在使用html5中上傳圖片或檔案,出現各種問題。
這一方面,我也一直沒有做過,今天就抽出了一點時間來學習一下。如今的示範範例已經ok了,我就給大家分享一下,希望對大家有協助。
好吧。我們先看看效果吧:
還行吧,來看頁面代碼:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><title>偽專家jqm檔案上傳</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css"><script src="http://code.jquery.com/jquery-1.8.3.min.js"></script><script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script></head><body><div data-role="page"> <div data-role="header" data-position="fixed"> <h1>偽專家jqm檔案上傳</h1> </div> <div class="ui-content"> <p><b>如有疑問:請加qq群135430763,共同學習!。。</b></p> <p><b>如有疑問:請加qq群135430763,共同學習!
!
!
</b></p> <div class="file-box"> <form action="FileServlet" method="post" enctype="multipart/form-data" data-ajax="false"> <input type="file" name="fileField" id="fileField" /> <input type="submit" name="submit" class="btn" value="上傳" /> </form> </div> <p><b>如有疑問:請加qq群135430763。共同學習!!!
</b></p> <p><b>如有疑問:請加qq群135430763,共同學習。!!
</b></p> </div> <div data-role="footer" data-position="fixed"> <h1>偽專家jqm檔案上傳</h1> </div></div></body></html>
在看看簡單的servlet代碼:
package com.herman.jqm.servlet;import java.io.File;import java.io.FileOutputStream;import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.util.List;import javax.servlet.ServletException;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import org.apache.commons.fileupload.FileItem;import org.apache.commons.fileupload.disk.DiskFileItemFactory;import org.apache.commons.fileupload.servlet.ServletFileUpload;/** * @see 上傳圖片或檔案FileServlet * @author Administrator * @date 2014年6月23日10:00:39 */public class FileServlet extends HttpServlet {private static final long serialVersionUID = 1L; /** * 預設建構函式 */ public FileServlet() { }/** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {}/** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */@SuppressWarnings("unchecked")protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {request.setChara
jqm檔案上傳,上傳圖片,jqm的表單操作,jqm的ajax的使用,jqm檔案操作大全,檔案操作demo