Procházet zdrojové kódy

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

José Loguercio před 9 roky
rodič
revize
712a42747a
1 změnil soubory, kde provedl 5 přidání a 0 odebrání
  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) {
             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],