File Naming

Overview

The File Naming panel helps control the file naming convention of new files and when uploading non-binary files. This does not apply to the naming of binary files. The Binary File Naming panel is specifically for controlling the file naming convention of binary file types.

File naming uses regular expressions, often referred to as regex, to control the characters allowed in the naming of a file. A commonly used regular expression in file naming is: [a-z0-9\-_.]*. This particular regular expression allows for the file name to include lowercase letters, numerals 0–9, hyphens, underscores, and periods. All other characters are disallowed, and filenames containing those characters would present the user with a warning message.

Certain characters are automatically excluded from OU Campus, and cannot be used for any filename, regardless of the custom regex being used. These characters are as follows:

!#$%^&*()[]\/?’”|<>{};:,+=

Note that the interface is case-insensitive, meaning that it is not allowed to have file names that differ only in case. Both filename.pcf and FILENAME.pcf are considered the same. The user interface and WebDAV both enforce this. Even in the event that the SaaS staging server or another server-type on an Enterprise system is using a Linux-type file system that allows for distinct files based on case sensitivity, they are not honored in OU Campus

During site creation, the Text Regex field becomes available after entering text in the File Name Regex field.

File Naming Options

  • Default Extension: The value defined in the site settings is used if a TCF does not specify an extension. Note: It is not necessary to enter the period for a file extension. The correct format for making a PCF-type file the default extension to be used when creating pages is: pcf
  • File Name Regex: A regular expression can be input into this field to limit the names of files. Regular expressions (regex) allow specification of whether or not letters, numbers, capitalization, etc., are allowed for page naming. A commonly used regex allows for lowercase letters, numbers, hyphens, underscores, and periods, and would be formatted as such: [a-z0-9\-_.]*
  • File Name Must NOT Match Regex: Select this checkbox to specify that the regex input that was not specified in File Name Regex should not be allowed.
  • Regex Description: The description is shown in addition to the standard error message. This is displayed during file upload via the WYSIWYG Editor, Source Editor, and the folder structure if the uploaded content does not conform to the defined regex.
  • Test Regex: When the File Name Regex field is used, this allows the administrator to test the configured regex to make sure that it is preventing the correct characters. The name of a file can be entered here and on-screen a green checkmark or red circle indicates the pass or fail status for the on-screen test.
  • Allow Uppercase in Folder Names: Allows that folders can be created with uppercase letters. If this is not selected, then the regex for the system allows for lowercase letters, numbers, underscores, tildes, and dashes to be used. If this setting is selected, then the CMS regex additionally allows for uppercase letters to be used. NOTE: If the TCF contains the force-lowercase="yes" attribute, this setting is overridden. Additionally, if force-lowercase is being used in the TCF with destination="{directory/}{dirname}" in the template tag, all the force-lowercase values (yes or no) must match.

File Naming Panel in Site Settings

File Naming Tutorial

The following provides an example for the use of file maming to restrict file names to use only lowercase letters, numbers, hyphens, underscores, or periods.

  1. Navigate to Setup > Sites, hover and from the Edit menu for the site, click Site.
  2. In the File Naming panel, enter the following regex described in the File Name Regex field: [a-z0-9\-_.]*
  3. Ensure that the checkbox for File Name Must Not Match is not selected.
  4. In Regex Description, enter a user message. For example, “Use lowercase letters, numbers, hyphens, underscores, and periods only.”

In Test Regex field, enter a phrase to test the regex syntax. In this example, a file name using lowercase letters, numbers, hyphens, underscores, and periods receives the green checkmark. Enter a file name with uppercase letters to receive an error.