Change name when file name contains more of a point MDL-6897 - patch submitted by Toni Mas

This commit is contained in:
skodak
2006-10-31 10:15:23 +00:00
parent f3410ae74b
commit f966e024ef
+4 -1
View File
@@ -301,7 +301,10 @@ class upload_manager {
* @todo verify return type - this function does not appear to return anything since $file is passed in by reference
*/
function handle_filename_collision($destination, &$file, $format='%s_%d.%s') {
$bits = explode('.', $file['name']);
$part1 = explode('.', $file['name']);
$bits = array();
$bits[1] = array_pop($part1);
$bits[0] = implode('.', $part1);
// check for collisions and append a nice numberydoo.
if (file_exists($destination .'/'. $file['name'])) {
$a->oldname = $file['name'];