5

I am trying to upload a word file into media manager: the file name is in unicode (in Russian) - файл_для_загрузки.docx . After upload the file automatically is being renamed to __.docx. How to disable this ? I want for the file to be uploaded without renaming. I am unable to rename it after upload either.

Thanks

7

Filenames pass through JFile::makeSafe() which strips everything except latin chars and numbers. Docs here (Good article in Russian language - here) . This is in the core and is not possible to be overridden AFAIK. You can modify Joomla core provided you are ABSOLUTELY sure that only valid unicode filenames will be used and your server is OK with them. Also you should be aware of any future core updates.

You have to comment the following row in \libraries\joomla\filesystem\file.php (row 90 in J!3.4.1):

 $file['name']     = JFile::makeSafe($file['name']);

or you can substitute it with an appropriate preg_replace - see here for samples. Also you have to comment following if statement in the same function:

if (!MediaHelper::canUpload($file, $err))

or to find some proper substitution for it.

After that uploading of files with unicode filenames is open to you. The questions - What to do with them?, and Will all work after that? are different case. I am answering to your question only. Shortly - do not do it. Find some third party extension which can suit you.

  • 2
    I liked the part: "What to do with them?, and Will all work after that? are different case." – FFrewin Jun 4 '15 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.