Role of enctype = multipart/form-data in form on the webpage

Source: Internet
Author: User

Enctype = "multipart/form-Data" is used to upload images in a form.


<Form name = "userinfo" method = "Post" Action = "first_submit.php" enctype = "multipart/form-Data">
Enctype = "multipart/form-Data" is set in the form label to ensure that the uploaded files are properly encoded.
As follows:
<TD Height = "30" altd = "right"> upload the Business License Image: </TD>
<TD> <input type = "file" name = "uploadfile" size = "34" onchange = "checkimage ()"> </TD>
Add enctype = "multipart/form-data ".

Enctype = "multipart/form-Data" in the form,Is to set the form mime encoding. By default, the encoding format is application/X-WWW-form-urlencoded and cannot be used for file upload. Only multipart/form-data can be used to completely transmit file data, perform the following operations.
Enctype = "multipart/form-Data" is used to upload binary data. The input value in form is passed in binary format.
The input value in form is passed in binary format, so the request will not get the value. That is to say, this section is addedCode, The request will fail to be passed. When the form value is added to the database, the following is used:

Smartupload su = new smartupload (); // create a new smartupload object

Su. getrequest (). getparametervalues (); returns the array value.

Su. getrequest (). getparameter (); obtain a single parameter value

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: 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.