File upload restriction to only docx

I want to restrict file type. For example I want only docx can be uploaded.

Hi,
as far as I remember the config only offers to define “bad” file extensions that can’t be uploaded. You could add a large list of extensions there.

In case no one else has a better idea, you could also dig through the source files and hardcode your restriction.

E: default bad extensions are:

'upload_badext' => 
  array (
    0 => 'php',
    1 => 'php3',
    2 => 'php4',
    3 => 'php5',
    4 => 'pl',
    5 => 'cgi',
    6 => 'py',
    7 => 'asp',
    8 => 'cfm',
    9 => 'js',
    10 => 'vbs',
    11 => 'html',
    12 => 'htm',
    13 => 'phtml',
  ),
1 Like

This is checking for Extension of file and adding .txt for the Bad/Restricted file type.
It does not throw any errors on the Front End?

There is another restriction for File Types in the File Field JS but where is it actually getting the array for “restrictUploadsByExtension” is not clear.

Anyone has thoughts on where to set the js File Type Restrictions ?