diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 23c10c5f65a..3864c8e254a 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -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;