Use the enctype attribute to specify the encoding type used by the browser when data is sent back to the server.
Below is the description:
Application/X-WWW-form-urlencoded: form data is encoded as name/value pairs. This is the standard encoding format.
Multipart/form-data: the form data is encoded as a message. Each control on the page corresponds to a part of the message.
Text/plain: the form data is encoded in plain text format, which does not contain any controls or format characters.
Used to upload images in a form.
<Form name = "userinfo" method = "Post" Action = "first_submit.jsp" 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:
<Tr>
<TD Height = "30" align = "right"> upload the Business License Image: </TD>
<TD> <input type = "file" name = "uploadfile" size = "34" encoding nchange = "checkimage ()"> </TD>
</Tr>
Add enctype = "multipart/form-data ".
In the form, enctype = "multipart/form-Data" indicates the mime encoding of the form. 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 values in form are 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, after this code is added, the request will fail to pass. When the form value is used to join 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
When there are many values, passing values through arrays is a good choice.
<Input type = 'text' name = 'formvar [year1] 'value = ''>
Function tohere ($ formvar)
{
Echo $ formvar ['ear1'];
}