Browse Source

Merge pull request #1102 from jloguercio/8173

Fix Renaming a document in upload document's form - Refs #8173
José Loguercio 9 years ago
parent
commit
56a1812577
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

@@ -2813,6 +2813,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],