... | ... |
@@ -214,6 +214,14 @@ class SecureDownloadsJob |
214 | 214 |
$strStartPath .= $folder . '/'; |
215 | 215 |
} |
216 | 216 |
|
217 |
+ // Do not overwrite existing files |
|
218 |
+ $copyId = 1; |
|
219 |
+ $baseFilename = $sanitizedFilename; |
|
220 |
+ while(file_exists(TL_ROOT . "/".$strTargetFolder.'/'.$sanitizedFilename)) |
|
221 |
+ { |
|
222 |
+ $sanitizedFilename = $baseFilename.'_'.$copyId++; |
|
223 |
+ } |
|
224 |
+ |
|
217 | 225 |
// Try to copy file |
218 | 226 |
if (!Files::getInstance()->copy($objFile->path,$strTargetFolder.'/'.$sanitizedFilename)) |
219 | 227 |
{ |