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

File type restrictions for Assignment submissions

    XMLWordPrintable

Details

    • MOODLE_25_STABLE, MOODLE_30_STABLE, MOODLE_31_STABLE, MOODLE_32_STABLE, MOODLE_33_STABLE
    • MOODLE_32_STABLE, MOODLE_33_STABLE
    • MDL-39913-master-new-validation
    • Hide

      Before Upgrade

      • Create an assignment
      • Then upgrade

      Test 1

      • Open one of the pre-existing assignments as a student
      • Go to add submission
      • Make sure no errors show and you can upload a file (any type)
      • As a teacher, edit the assignment
      • Make sure no errors show

      Test 2

      • Create an assignment
      • Log in as a student
      • Submit a .gif file
      • File uploads successfully

      Test 3

      • Type .doc and .pdf
      • 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
      Show
      Before Upgrade Create an assignment Then upgrade Test 1 Open one of the pre-existing assignments as a student Go to add submission Make sure no errors show and you can upload a file (any type) As a teacher, edit the assignment Make sure no errors show Test 2 Create an assignment Log in as a student Submit a .gif file File uploads successfully Test 3 Type .doc and .pdf 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
    • 3.3 sprint 5

    Description

      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]'));

      Attachments

        1. image002.png
          0.6 kB
          Doug Fletcher
        2. restrict-file.jpg
          180 kB
          Jun Wan
        3. restrict-file2.jpg
          247 kB
          Jun Wan
        4. type selection concept.png
          59 kB
          Jonathon Fowler
        5. usqfiletypes_M25_backport.patch
          3 kB
          Dave Balch

        Issue Links

          Activity

            People

              Votes:
              80 Vote for this issue
              Watchers:
              70 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Clockify

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.