/** * Sanitize files name (moves file if non regular name) */ protected function sanitizeFile($file) { if (basename($file) != dmOs::sanitizeFileName(basename($file))) { $renamedFile = dmOs::join(dirname($file), dmOs::sanitizeFileName(basename($file))); while (file_exists($renamedFile)) { $renamedFile = dmOs::randomizeFileName($renamedFile); } rename($file, $renamedFile); $file = $renamedFile; } return $file; }