Author Topic: [solved] Wrong upload (files to be sold) for cyrillic filenames (VM 1.1.9,UTF-8)  (Read 1173 times)


  • Readers
  • *
  • Posts: 0
When I upload a file "to be sold", the cyrillic name like 'кир123abc.jpg' is shrinked and uploaded as '123abc.jpg' (in VM database).
The uploaded filename on FTP-server is still 'кир123abc.jpg'.

mysql & website is in UTF-8, VM 1.1.9.

The generated Download Code leads to "file not found".
That should be fixed.

Can pay 20+$ via PayPal.


  • Readers
  • *
  • Posts: 0
Solved. Almost by myself.

1. File upload. File's title is retrieved from upload URL by basename() function, which depends on codepage.
reported bug:
# Alek$:
Самый неочивидный глюк PHP, с которым я имел дело выглядит так:
$file_basename = basename(‘Русское имя файла из нескольких слов.zip’);
Хз, почему, но в $file_basename оказивается не «Русское имя файла из нескольких слов.zip», как следовало бы ожидать, а «имя файла из нескольких слов.zip».
The solution is to force codepage in header of administrator\components\com_virtuemart\classes\ps_product_files.php:
Code: [Select]
<?php setlocale(LC_ALL'en_US.UTF8');
2. File downloads. Same:
Code: [Select]
<?php setlocale(LC_ALL'en_US.UTF8');+  the download is given back with UTF8 title -  only Google Chrome guesses to convert the title correctly,  other browsers, like IE, will download file as is:
' Единая Касса с фродом_пустой.doc'
The idea is to fix vmConnector::sendFile with iconv():
Code: [Select]
vmConnector::sendFile( $datei, $mime_type, iconv("UTF-8", "cp1251", basename($file_name)) );
Welcome :)

VirtueMart Forum