enctype: 'multipart/form-data',

enctype is encodetype is the type of encoding means.

multipart / form-data refers to form a plurality of data parts, meaning both text data, binary data files there.

Note that: By default, the value of enctype is application / x-www-form-urlencoded, can not be used for file uploads, only use the multipart / form-data, in order to complete the transfer file data.

application / x-www-form-urlencoded can not upload files, text format is only upload files, multipart / form-data file is uploaded in binary form, which can achieve a variety of types of file upload.

 

First, on the HTML <form> tag enctype attribute

application / x-www-form-urlencoded: before transmitting the encoded all characters (default)    

multipart / form-data: not character encoding, or when using a form include file upload control, you must use this value.

text / plain: converting spaces to "+" plus, but not a special character encoding.    

Two, enctype: a predetermined form when sent to the server in the form encoding method has the following three values.

1, application / x-www-form-urlencoded. The default encoding. But when the text transmission and other large MP3 files, use this coding becomes inefficient. 

2, multipart / form-data. Designated to transmit data to a binary type, such as images, mp3, documents. 

3, text / plain. Transmission pure style. Spaces converted to "+" plus, but not a special character encoding.

Guess you like

Origin www.cnblogs.com/hofmann/p/12625512.html