LJ tweaks.

git-svn-id: https://develop.svn.wordpress.org/trunk@3375 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2005-12-29 01:25:41 +00:00
parent ba3372e3d0
commit e45a58d547
3 changed files with 76 additions and 40 deletions

View File

@@ -1750,8 +1750,16 @@ function wp_handle_upload(&$file, $overrides = false) {
} else {
$number = '';
$filename = $file['name'];
while ( file_exists($uploads['path'] . "/$filename") )
$filename = str_replace("$number.$ext", ++$number . ".$ext", $filename);
if ( empty($ext) )
$ext = '';
else
$ext = ".$ext";
while ( file_exists($uploads['path'] . "/$filename") ) {
if ( '' == "$number$ext" )
$filename = $filename . ++$number . $ext;
else
$filename = str_replace("$number$ext", ++$number . $ext, $filename);
}
}
// Move the file to the uploads dir