For file Upload encoding problems, use Flash + PHP to batch upload files. PHP encountered the encoding problem when saving the file: PHPcode & lt ;? Phpheader (& quot; Content-Type: text/html; charset = utf-8 & quot;); file Upload encoding problems
Use Flash + PHP to batch upload files. PHP encountered encoding problems when saving files:
PHP code
The file name is very nonstandard, including Chinese, English, French, Russian ,...... Uncertain type. at this time, some files are saved, either garbled or truncated (all extensions are lost ). Iconv ('utf-8', 'gbk', $ _ POST ['FN ']). What is the problem here? What should I do?
------ Solution --------------------
Your current page uses UTF-8
Header ("Content-Type: text/html; charset = utf-8 ");
This should not be converted to gbk.
$ Uploadfile = $ uploaddir. iconv ('utf-8', 'gbk', $ _ POST ['FN ']);
Remove or
$ Uploadfile = $ uploaddir. iconv ('gbk', 'utf-8', $ _ POST ['FN ']);
Try
------ Solution --------------------
The GBK-encoded string does not contain the Russian characters. That is to say, it only applies to Chinese
We recommend that you use UTF-8 to save the file. the file name is garbled.
------ Solution --------------------
$ Uploadfile = $ uploaddir. base64_encode ($ _ POST ['FN ']).'. '. pathinfo ($ _ POST 'FN'], PATHINFO_EXTENSION );
------ Solution --------------------
What should you do if your data source is GBK.
Iconv uses // IGNORE to IGNORE special characters and convert them to UTF8 or rename them.
------ Solution --------------------
On your windows Server, can you enter Russian and Arabic to name a file?
The file name depends on the encoding of the customer's operating system. Generally, Chinese users use the Chinese version of windows. the default internal encoding of the system is GBK. how can GBK contain Russian and other languages. Or in other words you let the operating system code for the ISO-8859-1 user to download your Chinese name File, Chinese even if you convert to gbk is not the same as garbled. Simply name it randomly. Otherwise, there will be a good method. The User System code varies widely across the world, unless all of them use UTF-8 as the internal code, you don't have to bother using iconv.
You can see that I am using ubuntu now, and the system code is UTF-8. if you do not convert Chinese to Russian and French, if you do not convert GBK to a user like me, the code is garbled. Haha.