When you browse ftp with ftp client you see ANSI-encoded names (single-byte encodings). In this case
нова-категория.png
is actually UTF-8 (double-byte) encodedнова-категория.png
When you upload file to web server, browser convert non unicode symbols in file name to UTF-8 (
нова-категория.png
becomesнова-категория.png
)When you request
site.com/images/pc/нова-категория.png
browser again convert non unicode symbols to UTF-8 and server actually looks forнова-категория.png
(in ASCI-encoding).
So if you want to see "normal" names in ftp-client, you should convert them to your native encoding
function upload_file($f,$fn){
$fn=iconv("UTF-8","Windows-1251",$fn);
switch($f['type']){
...
But in this case you'll have problems with URLs to your files. To write correct URL to ANSI-encoded names you should use this php code:
echo "site.com/images/pc/".rawurlencode("нова-категория.txt");
The way you should handle file names is depends on your use of that files. But I don't recommend you to convert them. If you have problem, I thinks its not in "broken" names.