PHP 7.2.0 Beta 1 Released

Voting

Please answer this simple SPAM challenge: six plus one?
(Example: nine)

The Note You're Voting On

maya_gomez ~ at ~ mail ~ dot ~ ru
13 years ago
when you upload the file, $_FILES['file']['name'] contains its original name converted into server's default charset.
if a name contain characters that aren't present in default charset, the conversion fails and the $_FILES['file']['name'] remains in original charset.

i've got this behavior when uploading from a windows-1251 environment into koi8-r. if a filename has the number sign "" (0xb9), it DOES NOT GET CONVERTED as soon as there is no such character in koi8-r.

Workaround i use:

<?php
if (strstr ($_FILES['file']['name'], chr(0xb9)) != "")
{
   
$_FILES['file']['name'] = iconv (
       
"windows-1251",
       
"koi8-r",
       
str_replace (chr(0xb9), "N.", $_FILES['file']['name']));
};
?>

<< Back to user notes page

To Top