Restricting upload file types

Restricting upload file types

by Peter Diedrichs -
Number of replies: 6
Picture of Particularly helpful Moodlers

Is there any way to restrict what file types users may upload, on a system wide level.

I also need the teachers to be able to further restrict file types for assignments.

Using Moodle 2.6.5.

Average of ratings: -
In reply to Peter Diedrichs

Re: Restricting upload file types

by Colin Fraser -

AFAIK, this has not been a consideration of Moodle, such restrictions have, traditionally, not been an interest for Open Source or Freeware products ... I understand that restrictions can be placed on file types in the server, or perhaps in PHP but these then become site wide, but this may not really be useful. The trouble with site wide restrictions is that, inevitably, a restriction on tif files, for instance, won't help the digital imagery courses, or raw files won't necessarily sit well with the photography classes and so on...  

I would suggest perhaps a filter or block that can be added to courses. Course Creators or Teachers can add the filter or block to where it is needed, not site wide. You can localise restrictions without limiting different faculties - which I would offer as a much better approach. 

If you wanted to hack a solution, then you are going to have to find the most likely the likely place to put the hack. There are 74 files and directories that are used to control uploads, so you will have to be very careful to target the right files in the right places.  

You won't want to restrict an mp3 file in a music class for instance, but you would not necessarily want an mp3 file in a science class on neurological systems, but might want a mp4 file. 

You may also want to ask this same question in the Developer's forum, or perhaps place it into the Moodle Tracker as a suggested feature. You will have to explain your circumstances and may have to make a case as a general option for future development - I am sure that if you want it, then chances are there will be others who could use such an option at a course level.   

In reply to Peter Diedrichs

Re: Restricting upload file types

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Just to repeat - why?

It's tricky, because do you really mean that you want to restrict file types or file extensions... or even mime-types?

In reply to Howard Miller

Re: Restricting upload file types

by John Provasnik -
Picture of Particularly helpful Moodlers Picture of Testers

Another reason is even though we direct our students to upload PDFs of their assignments (so we can use the PDF Annotator), some students still upload word documents. So I think having file upload restrictions  that are set per assignment would be a great idea.

In reply to Peter Diedrichs

Re: Restricting upload file types

by Dave Balch -

You should probably take a look at MDL-39913, which AFAIK is the most developed approach to restricting file types in Moodle.

In reply to Dave Balch

Re: Restricting upload file types

by Peter Diedrichs -
Picture of Particularly helpful Moodlers

Thank you for answers and suggestions, I will follow them up!

As to the "why?": there are file types that we don't want uploaded. For instance several students who have Mac upload pages documents, but our general approach is that they should use rtf, doc/docx or pdf. Most of our teachers cannot open pages (I know, they can install an add-on, but still. And there are other "strange" formats that the students upload, instead of saving in a more common format). Some users even manage to upload desktop shortcuts/icons and URL adresses.

We do see the problem with restricting too many file types, but restricting some of them would make all our lives easier ;)

 

In reply to Dave Balch

Re: Restricting upload file types

by Elizabeth Dalton -

This only restricts file types for assignments.

We want to prevent our instructors from loading large media files directly into Moodle, because we use Kaltura for streaming media and our instructors tend to forget that. I really don't understand why this request is controversial. It keeps coming up, so it would seem that quite a few institutions want it.

Average of ratings: Useful (4)