Browse Source

Merge branch '1.10.x' of github.com:chamilo/chamilo-lms into 1.10.x

jmontoya 9 years ago
parent
commit
70846f9926
2 changed files with 8 additions and 3 deletions
  1. 5 0
      main/inc/lib/document.lib.php
  2. 3 3
      main/inc/lib/message.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],

+ 3 - 3
main/inc/lib/message.lib.php

@@ -364,9 +364,9 @@ class MessageManager
             $sender_info = api_get_user_info($user_sender_id);
             
             // add file attachment additional attributes
-            foreach ($file_attachments as $file_attach) {
-                $file_attachments['path'] = $file_attach['tmp_name'];
-                $file_attachments['filename'] = $file_attach['name'];
+            foreach ($file_attachments as $index => $file_attach) {
+                $file_attachments[$index]['path'] = $file_attach['tmp_name'];
+                $file_attachments[$index]['filename'] = $file_attach['name'];
             }
 
             if (empty($group_id)) {