Index: lib/class.tx_dam.php =================================================================== --- lib/class.tx_dam.php (revision 25890) +++ lib/class.tx_dam.php (working copy) @@ -462,6 +462,11 @@ $filename = substr ($path_parts['filebody'], 0, $maxFileNameLength); } } + + if (tx_dam::config_checkValueEnabled('mod.txdamM1_SHARED.systemCleanFileName')) { + $basicFileFuncObj = t3lib_div::makeInstance('t3lib_basicFileFunctions'); + $filename = $basicFileFuncObj->cleanFileName($filename); + } return $filename; } Index: lib/class.tx_dam_indexing.php =================================================================== --- lib/class.tx_dam_indexing.php (revision 25890) +++ lib/class.tx_dam_indexing.php (working copy) @@ -1551,11 +1551,16 @@ $orgTitle = $title; $extpos = strrpos($title,'.'); $title = $extpos ? substr($title, 0, $extpos) : $title; // remove extension - $title = str_replace('_',' ',$title); // Substituting "_" for " " because many filenames may have this instead of a space char. - $title = str_replace('%20',' ',$title); - // studly caps: add spaces - $title = preg_replace('#([a-z])([A-Z])#', '\\1 \\2', $title); - + + if( count($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['dam']['uploadedFilenamesStorage'][$title]) ) { + // the title will be an oryginal filename. This info is stored wile uploading file. + $title = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['dam']['uploadedFilenamesStorage'][$title]; + } else { + $title = str_replace('_',' ',$title); // Substituting "_" for " " because many filenames may have this instead of a space char. + $title = str_replace('%20',' ',$title); + // studly caps: add spaces + $title = preg_replace('#([a-z])([A-Z])#', '\\1 \\2', $title); + } if ($this->writeDevLog) t3lib_div::devLog('makeTitleFromFilename(): '.$orgTitle.' > '.$title, 'tx_dam_indexing'); return $title; Index: binding/tce/class.tx_dam_tce_extfilefunc.php =================================================================== --- binding/tce/class.tx_dam_tce_extfilefunc.php (revision 25890) +++ binding/tce/class.tx_dam_tce_extfilefunc.php (working copy) @@ -379,6 +379,13 @@ return; } + // Store the oryginal filename to be used as title when the file will be indexed later + if (tx_dam::config_checkValueEnabled('mod.txdamM1_SHARED.systemCleanFileName')) { + $oryginalPathParts = pathinfo($_FILES['upload_'.$id]['name']); + $cleanedPathParts = pathinfo($theNewFile); + $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['dam']['uploadedFilenamesStorage'][$cleanedPathParts['filename']] = $oryginalPathParts['filename']; + } + // move uploaded file to target location t3lib_div::upload_copy_move($theFile,$theNewFile); clearstatcache();