jqm檔案上傳,上傳圖片,jqm的表單操作,jqm的ajax的使用,jqm檔案操作大全,檔案操作demo

來源:互聯網
上載者:User

標籤: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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.