]> git.mjollnir.org Git - moodle.git/commitdiff
Change name when file name contains more of a point MDL-6897 - patch submitted by...
authorskodak <skodak>
Tue, 31 Oct 2006 10:16:26 +0000 (10:16 +0000)
committerskodak <skodak>
Tue, 31 Oct 2006 10:16:26 +0000 (10:16 +0000)
lib/uploadlib.php

index 2be27a80946e7b97565d54beef3bba09f1ee1a0f..db6e4e2830ada636532b9a48dc432d5d85c71315 100644 (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'];