SPRINGMVC Jquery-ajax Building Server FTP

Source: Internet
Author: User

The SPRINGMVC in the Multipartfile property is used to receive type= "file" in the front-end form submission

To use the Multipartfile property, you only need to configure the configuration multipartresolver in Servlet.xml:

    <BeanID= "Multipartresolver"class= "Org.springframework.web.multipart.commons.CommonsMultipartResolver">          < Propertyname= "Maxuploadsize"value= "1024000"></ Property>          < Propertyname= "Defaultencoding"value= "Utf-8"></ Property>    </Bean>  

The specific other parameters can be self-Baidu

The attributes are detailed in the following:

Defaultencoding configuration Request encoding format, default to Iso-8859-1 (contains Chinese name of the file to configure Utf-8, otherwise background use Getoriginalfilename () will be garbled)

Maximum unit of maxuploadsize configuration file, in bytes

In addition, the front-end form needs to be set Enctype code, set to: Enctype= "Multipart/form-data"

Related definitions:

(The Enctype property specifies how the form data should be encoded before it is sent to the server.)

By default, the form data is encoded as "application/x-www-form-urlencoded". That is, all characters are encoded before being sent to the server (spaces are converted to "+" plus signs, and special symbols are converted to ASCII HEX values). )

Finally, the Formdata object is used to receive a file, and the client interface is invoked to xmlhttprequest the data to the controller on the background (the process can be simplified to use AJAX)

The front end can increase the description of the file information (save path, file name redefinition, etc.), with the file sent to the background controller, so that the server FTP

Front-end file upload also has a lot of powerful plug-ins, such as uploadify can set the transmission progress

SPRINGMVC Jquery-ajax Building Server FTP

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.