Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-44600

mod/assign: File type restrictions for Assignment submissions + Information

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 2.7
    • Fix Version/s: None
    • Component/s: Assignment
    • Testing Instructions:
      Hide

      Test 1

      Create an assignment, set “restrict file types” to No
      Log in as a student
      Submit a .gif file
      File uploads successfully

      Test 2

      Create an assignment, set “restrict file types” to Yes
      Select Word and PDF formats
      Log in as a student
      Upload a Word document
      File uploads successfully
      Upload a PDF document
      File uploads successfully
      Upload a gif file
      File will not upload

      Test 3

      Create an assignment, set “restrict file types” to Yes
      Select Other format, de-select other formats
      Enter “txt” (without quotes)
      Save
      Validation error message is displayed and form does not save
      Change Other to be “*.txt” (without quotes)
      Save
      Form saves successfully
      Log in as student
      Upload .docx file
      File does not upload
      Upload .txt file
      File uploads successfully

      Test 4

      Create an assignment, set “restrict file types” to Yes
      Select Other format, de-select other formats
      Enter “txt,java”
      Save
      Validation error message is displayed and form does not save
      Change Other to be “.txt;.java”
      Save
      Validation error message is displayed and form does not save
      Change Other to be “.txt,.java”
      Save
      Form saves successfully
      Log in as student
      Upload .txt file
      File uploads successfully

      Test 5

      Create an assignment, set “restrict file types” to Yes
      De-select all formats
      Save
      Validation error message is displayed and form does not save

      AND

      1. Create an assignment with restrict file types is enabled
      2. And go to add submission and see the list of acceptable file types in file submissions section if any

      Show
      Test 1 Create an assignment, set “restrict file types” to No Log in as a student Submit a .gif file File uploads successfully Test 2 Create an assignment, set “restrict file types” to Yes Select Word and PDF formats Log in as a student Upload a Word document File uploads successfully Upload a PDF document File uploads successfully Upload a gif file File will not upload Test 3 Create an assignment, set “restrict file types” to Yes Select Other format, de-select other formats Enter “txt” (without quotes) Save Validation error message is displayed and form does not save Change Other to be “*.txt” (without quotes) Save Form saves successfully Log in as student Upload .docx file File does not upload Upload .txt file File uploads successfully Test 4 Create an assignment, set “restrict file types” to Yes Select Other format, de-select other formats Enter “txt,java” Save Validation error message is displayed and form does not save Change Other to be “.txt;.java” Save Validation error message is displayed and form does not save Change Other to be “.txt,.java” Save Form saves successfully Log in as student Upload .txt file File uploads successfully Test 5 Create an assignment, set “restrict file types” to Yes De-select all formats Save Validation error message is displayed and form does not save AND 1. Create an assignment with restrict file types is enabled 2. And go to add submission and see the list of acceptable file types in file submissions section if any
    • Affected Branches:
      MOODLE_27_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      mdl44600-master

      Description

      2.4
      DESCRIPTION UP FOR DISCUSSION IN https://moodle.org/mod/forum/discuss.php?d=217532#p996584

      When creating an assignment, teachers should have the option to restrict the types of files students may submit. When a student edits their submission, the filepicker should not allow files to be uploaded that do not match the specified filetypes.

      The filetype options should be as follows:

      Word (*.doc, *.docx, *.rtf) - selected by default
      PDF (*.pdf) - selected by default
      Image (*.gif, *.jpg, *.jpeg, *.png), *.svg, *.tiff)
      Video (*.mp4, *.flv, *.mov, *.avi)
      Audio (*.mp3, *.ogg, *.wav, *.aac, *.wma)
      Other (text box, type in comma-separated)

      The settings should be located within the "submission settings" area.

      Note: it may be easier to use Moodle's in-built file_get_typegroup function to retrieve sets of related extensions - for discussion.

      Notes on settings:
      ● the "restrict file types" option should only be enabled if "file submissions" is on
      ● the file type options (Word, PDF, etc) should only be enabled if "restrict file types" is on
      ● form validation should ensure the "other" value is in the correct format, eg *.extn (comma-separated list)
      ● Error message: List should be in the format .doc,.docx
      ● form validation should ensure that if "restrict file types" if set to "yes", then at least one file type must be checked
      ● help text should be as follows:
      ● If Restrict File Types is enabled, you can specify the file formats you will accept for this assignment. Students will not be able to upload files that are not in the format you select.
      ● If Restrict File Types is set to No, there will be no restriction on the type of files students may submit.

      The filepicker element in the edit submission page should restrict the file types based on the assignment settings.

      $mform->addElement('filepicker', 'userfile', get_string('file'), null, array('maxbytes' => $maxbytes, 'accepted_types' => '[filetypes]'));

      Add acceptable file types information when file type restriction feature is enabled in assignment activities

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              tlock Tim Lock
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              4 Vote for this issue
              Watchers:
              11 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: