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);
$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;