You can allow students to attach files to a discussion by changing the settings from the Discussions page. Any attachments added to an ungraded discussion by a student are copied to the student's user files and count against the user quota. However, attachments added to a graded discussion are not counted against the quota.
This setting can also be changed from the Course Settings page.
Disabling this option will restrict students from attaching files in discussion topics, discussion replies, and discussions within course groups. This option does not affect your students' ability to add a file using the Rich Content Editor.
Note: If a student creates a discussion with an attached file, the file will be added to course files in the unfiled folder.