JQM file Upload, upload pictures, jqm form operation, JQM Ajax use, JQM file operations Daquan, file operation demo

Source: Internet
Author: User

Recently seen in the forum. There are a variety of issues with uploading pictures or files using HTML5.

In this regard, I have not done, and today took a little time to learn. Today's demo sample is OK, I will share with you, I hope to help everyone.


All right. Let's look at the effect first:

OK, look at the page code:

<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >

。。 </b></p> <p><b> If in doubt: please add QQ group 135430763, learn together!

</b></p> <div class= "File-box" > <form action= "fileservlet" method= "post" enctype= "multipart/f Orm-data "data-ajax=" false "> <input type=" file "Name=" Filefield "id=" Filefield "/> <in Put type= "Submit" name= "Submit" class= "btn" value= "Upload"/> </form> </div> <p><b> If in doubt: please add QQ group 135430763. Learn together!!!

</b></p> <p><b> If in doubt: please add QQ group 135430763, learn together.

</b></p> </div> <div data-role= "Footer" data-position= "fixed" >

Look at the simple servlet code:
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 upload pictures or files Fileservlet * @author Administrator * @date    June 23, 2014 10:00:39 */public class Fileservlet extends HttpServlet {private static final long serialversionuid = 1L; /** * Default constructor */Public Fileservlet () {}/** * @see httpservlet#doget (httpservletrequest request, Httpservle Tresponse 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 file Upload, upload pictures, jqm form operation, JQM Ajax use, JQM file operations Daquan, file operation demo

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.