Happy New Year !! I used the yii2 form. Previously, my form did not contain the Upload file & amp; lt; inputtype & quot; file & quot; & amp; gt;, and the Chinese field is normal, however, after the file is uploaded, set & #039; enctype & #039; & amp; gt; & #039; multipartform-data & #039 ;, then there is a problem with the upload. I...Happy New Year !!
I used the yii2 form. Previously, my form did not contain an uploaded file.
The Chinese field is normal, but after the file is uploaded'enctype' => 'multipart/form-data'
And then the upload fails. I found that$_POST
All Chinese fields in are garbled, and the Chinese characters stored in the database are also garbled. Useaccept-charset
Setting character sets does not work either. How can this problem be solved?
Reply content:Happy New Year !!
I used the yii2 form. Previously, my form did not contain an uploaded file.
The Chinese field is normal, but after the file is uploaded'enctype' => 'multipart/form-data'
And then the upload fails. I found that$_POST
All Chinese fields in are garbled, and the Chinese characters stored in the database are also garbled. Useaccept-charset
Setting character sets does not work either. How can this problem be solved?
You can do this:
Enctype = "multipart/form-data; charsets = UTF-8"
Other approaches:
It is best to use the error_log (print_r ($ _ POST, 1) output to see it, without the built-in debuger.
Php. ini: default_charset = "UTF-8" can be modified"
You can modify. htaccess: AddCharset UTF-8. php
Your page is directly returned after submission$POST
?
First, set the form page and display$_POST
To the same character encoding, such
We recommend that you upload files to a separate form.