You can allow students to attach files to a discussion by changing the settings from the Discussions page.
This setting can also be changed from the Course Settings page.
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.