An admin comes onto the website and creates an assignment which is a content type. Students come onto the website and create submissions that point to the certain assignment. There is a file upload field where students can upload their submission. I want to make it so when the admin creates the assignment, he/she can choose which file types are allowed. Is there a field that will automatically process what file types the admin chose so that a student can only upload that specific file type?

  • Hi. I don't think that it's possible to do it via some module. But I can provide step by step instruction for developer, how to do it. Is it suitable for you? – Eugene Aug 18 '15 at 4:12
  • Yes, I prefer to do most of the stuff on the website in my own custom modules, could you provide an explanation? @Eugene – Matt Aug 18 '15 at 14:19

So, it's the rough instruction step by step as Matt asked:

  1. Add new field where you can specify the allowed extensions of the files.

  2. Alter the form of your submission via hook_form_alter() and find your file upload field enter image description here

  3. Specify your allowed extensions from your field with extensions into this point

  • What application did you use to find all of this field information? Sorry, I'm pretty new to Drupal. – Matt Aug 18 '15 at 15:30
  • It's PHPStorm in debug mode – Eugene Aug 18 '15 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.