Restricting accepted collection file types

Hello,

I am wondering if there is a way to only allow for certain file types to be uploaded using the Collecting module. I.e. if I do not want people to upload .png files, is there a way to prevent Omeka from accepting their contribution if they try to upload a .png file? Of course, I can write the desired file types in the prompt, but that’s not a guaranteed solution.

Thank you!

The only way to restrict uploads to a certain file type is to modify the “Allowed media types” or “Allowed file extensions” in the global Settings page (under Security). That will restrict all uploads, not just ones collected via the Collection module.

If you’re comfortable modifying code, you could limit accepted file types by opening this file:

modules/Collecting/src/MediaType/Upload.php

And changing this:

'attributes' => [
    'required' => $prompt->required(),
],

To this:

'attributes' => [
    'required' => $prompt->required(),
    'accept' => '.png',
],

This will affect all upload prompts.

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.