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.
Note: If a student creates a discussion with an attached file, the file will be added to course files in the unfiled folder.
Edit Discussion Settings
Check the Attach files to discussions checkbox.
Note: Unchecking this option will restrict students from attaching files within Discussions. This permission affects posts in new discussion topics, discussion replies, and discussions within course groups.