mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX #5199 Duplicate file uploads have odd numbering attached to end of file (from r101068)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@111581 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
81ce1e358d
commit
a729b86df8
@ -249,12 +249,11 @@ class Folder extends File {
|
||||
while(file_exists("$base/$file$ext")) {
|
||||
$i++;
|
||||
$oldFile = $file;
|
||||
$file = "$origFile-$i";
|
||||
|
||||
if(strpos($file, '.') !== false) {
|
||||
$file = ereg_replace('[0-9]*(\.[^.]+$)',$i . '\\1', $file);
|
||||
} else if (strpos($file, '_') !== false) {
|
||||
$file = ereg_replace('_([^_]+$)', '_'.$i, $file);
|
||||
$file = ereg_replace('[0-9]*(\.[^.]+$)', $i . '\\1', $file);
|
||||
} elseif(strpos($file, '_') !== false) {
|
||||
$file = ereg_replace('_([^_]+$)', '_' . $i, $file);
|
||||
} else {
|
||||
$file .= "_$i";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user