Bläddra i källkod

Merge pull request #1102 from jloguercio/8173

Fix Renaming a document in upload document's form - Refs #8173
José Loguercio 9 år sedan
förälder
incheckning
56a1812577
1 ändrade filer med 5 tillägg och 0 borttagningar
  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) {
             if ($upload_ok) {
                 // File got on the server without problems, now process it
                 // 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(
                 $new_path = handle_uploaded_document(
                     $course_info,
                     $course_info,
                     $files[$fileKey],
                     $files[$fileKey],