Nucleus .Net Core CMS

Models.Configuration.AllowedFileType Class

Namespace: Nucleus.Abstractions.Models.Configuration
Assembly: Nucleus.Abstractions.dll
Represents the configurable options for a file type signature.

Remarks

File type signatures are configured in appSettings.json and are used to check the integrity of uploaded files.

Example

"AllowedFileTypes": { 
  "JPEG": { "FileExtensions": [".jpg", ".jpeg"], "Signatures": [ "FFD8FFE0", "FFD8FFE2", "FFD8FFE3" ] } 
 }

Properties

FileExtensions Property

List of allowed file extensions for the allowed file type.
Remarks
Some file types can have multiple file extensions.

Signatures Property

A list of signatures for the file type. Signatures are used to validate that the file contents match the file type (extension).
Remarks
During upload, files integrity is validated by comparing the first few bytes of the file with the specified signatures. The file bytes must match at least one of the signatures. Signatures are specified as hexadecimal values, with no spaces or delimiters. The special value "??" in a signature skips validation of the byte in the ordinal position represented by the ?? characters.

Restricted Property

Specifies whether uploads of the file type are restricted to site administrators.