I have found the solution. I based on post:
https://forums.modx.com/thread/73940/revolution-removing-unwanted-forreign-characters-on-file-upload-that-breaks-stuff-like-phpthumb
I that line I have pasted the method that checked if uploaded file exists and add to the name post fix:
in:
/core/model/modx/sources/modfilemediasource.class.php
I declare method:
public function smartDoNotReplaceDuplicates($name) {
if (file_exists($name)) {
$extention = explode(".",$name);
$extention = end($extention);
$file=$name;
$extention = explode(".",$file);
$extention = end($extention);
$killDuplicate = substr($file,0,strlen($file)-strlen($extention)-1);
return $this->smartDoNotReplaceDuplicates($killDuplicate."_2.".$extention);
} else {
return $name;
}
}
and in method:
after line
$newPath = $directory->getPath().$newPath;
I added this line :
$newPath = $this->smartDoNotReplaceDuplicates($newPath);