]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15405 Final bit to make forum attachments work with filepicker
authormoodler <moodler>
Wed, 3 Sep 2008 06:07:36 +0000 (06:07 +0000)
committermoodler <moodler>
Wed, 3 Sep 2008 06:07:36 +0000 (06:07 +0000)
mod/forum/lib.php

index 23c10c5f65a5e301e6557cf50c61471d96ba557b..3864c8e254a9e314afa29a8c711f1290fde16f7f 100644 (file)
@@ -4030,13 +4030,8 @@ function forum_add_attachment($post, $cm, $mform=null, &$message=null, $remove_p
         return false;
     }
 
-    $filename = $mform->get_new_filename('attachment');
     $filearea = 'forum_attachment';
 
-    if ($filename === false) {
-        return false;
-    }
-
     $fs = get_file_storage();
 
     $context = get_context_instance(CONTEXT_MODULE, $cm->id);
@@ -4047,7 +4042,7 @@ function forum_add_attachment($post, $cm, $mform=null, &$message=null, $remove_p
         $DB->update_record('forum_posts', $post);
     }
 
-    if ($mform->save_stored_file('attachment', $context->id, $filearea, $post->id, '/', $filename, true, $USER->id)) {
+    if ($mform->save_stored_file('attachment', $context->id, $filearea, $post->id, '/', null, true, $USER->id)) {
         $post->attachment = '1';
         $DB->update_record('forum_posts', $post);
         return true;