I am trying to preserve after the upload the orifinal name of the file (in my case could be Russian or English).
I tried to set UTF-8 for internal/external mbstring and also in the page which is cotaining the form I am using
UTF-8 encoding.
Despise all of these, all my uploads with files in Russian are done with the named f***ed up;
Could any one help me to resolve this?
As a side note, I did the same test on yahoo mail and gmail. Guess what? Just gmail handle correct the file name.
regards,
Mihai
Problems when uploading a file named in russian
Moderator: General Moderators
post your code. This simple snippet gave me the correct results:
For tests I used file named "Мысли.doc"
Note that to save the file on server under original name your server's filesystem must support utf8 filenames (which isn't the case for the vast majority of hosts)
Another note: I have no mbstring input/output conversions in place
Code: Select all
header("Content-type: text/html;charset=utf8");
if(count($_FILES)) {
var_dump($_FILES);
}
echo <<<HTML
<form method='post' enctype='multipart/form-data'>
<input type='file' name='file'/>
<input type='submit' />
</form>
HTML;Note that to save the file on server under original name your server's filesystem must support utf8 filenames (which isn't the case for the vast majority of hosts)
Another note: I have no mbstring input/output conversions in place
Unfortunately the problem is this: the file system is saving the file name with incorrect characters. If I copied this chars in a html page and I set the encoding utf8, it will be displayed OK. But if I am looking at the file in explorer/totalcomander it will be incorrect.
This what I end up when is uploading: фйцуф.jpg
And this is what I was uploaded: фйцуф.jpg
I have tried both on my Windows Xp instalation (Apache + PHP5) and Linux. The same result I get.
This what I end up when is uploading: фйцуф.jpg
And this is what I was uploaded: фйцуф.jpg
I have tried both on my Windows Xp instalation (Apache + PHP5) and Linux. The same result I get.