Spring MVC upload file error string cannot be converted to multipartfile

Recently, I encountered a type receiving error when uploading with springmvc. The input tag of file type is set in the JSP form, but an error is reported when receiving with multipartfile in springmvc, which roughly means that string convert multipartfile has an error. Finally, I know that I am using form submission. The enctype attribute in the form must be set to enctype = “multipart/form data”, Because only this attribute means that the file file is uploaded, and I didn’t write it

The enctype in the form has three attributes: 1. Application/x-www-form-urlencoded. 2、multipart/form-data。   3、text/plain

1: Encode all characters before encoding, including special characters, convert spaces to “+” symbols, and special characters to ASCII hex values. It is also the default setting for form

2: No character encoding. This value must be used when using a form containing a file upload control, and the file will be read in a binary stream

3: Spaces are converted to a “+” plus sign, but special characters are not encoded

 

Similar Posts: