Browse Source

Fix Renaming a document in upload document's form - Refs #8173

José Loguercio 9 years ago
parent
commit
712a42747a
1 changed files with 5 additions and 0 deletions
  1. 5 0
      main/inc/lib/document.lib.php

+ 5 - 0
main/inc/lib/document.lib.php

@@ -2815,6 +2815,11 @@ class DocumentManager
 
             if ($upload_ok) {
                 // File got on the server without problems, now process it
+                if ($title) {
+                    $titleAndExt = explode('.', $files[$fileKey]['name']);
+                    $ext = end($titleAndExt);
+                    $files[$fileKey]['name'] = $title.'.'.$ext;
+                }
                 $new_path = handle_uploaded_document(
                     $course_info,
                     $files[$fileKey],