+

Search Tips   |   Advanced Search

Restrict file types in Files

We can restrict the types of files that users can upload in Files.

We can create a list of denied file extensions and prevent users from uploading files with those extensions. We can also create a list of allowed file extensions and only allow users to upload files with those extensions.

Restricting file types affects users uploading new files, or changing the extensions of existing files. Users cannot change existing files to a denied type. Existing documents with denied extensions are not affected. For example, if you deny the .xls extension, users cannot upload .xls files or change existing files to have the .xls extension. But existing .xls files are not affected, and users can still upload new versions of them.

This is not intended as a security application. Files are not analyzed to determine their type, only the file name is read to allow or deny (with an error) the upload. This is only to help restrict the types of files you store in the environment.

To restrict file types in Files:

  1. Check out the Files configuration files:

    To get cell name...

  2. Open files-config.xml.

  3. In the <restrictions> element in the <file> section, specify the enabled attribute as true.

  4. In the <restrictions> element in the <file> section, specify the mode attribute as one of the following values:

    • A value of allow means the extensions in the list are the only ones allowed to be uploaded.

    • A value of deny means the extensions in the list are the only ones not allowed to be uploaded.

  5. In the <restrictions> element, add an <extensions> element, and within the <extensions> element add one or more <extension> elements, each containing a file extension to allow or deny.

  6. Check the configuration files back in after making changes, and they must be checked in during the same wsadmin session in which they were checked out for the changes to take effect. See the topic Apply Files property changes for details.


Example

<file>
 ....
 <restrictions enabled="true" mode="allow">
  <extensions>
  <extension>odt</extension>
  <extension>odp</extension>
  <extension>ods</extension>
  </extensions>
 </restrictions>
</file>

In this example, files with .odt, .odp, or .ods extensions are the only file types that users can upload.

Use an empty <extension> element to allow or deny files without extensions, or with extensions that exceed the platform limit of 16 characters.


Parent topic:
Administer Files


Related:

Apply Files property changes

Related reference:

Files configuration properties