DFO 3.0.0 - 15 Understanding upload and media types

This guide explains the concept of media types inside Optimizely, and how to define specialized media types when setting up an Optimizely website. From Optimizely it is recommended that you create specific classes for media of the types images, video, and anything generic other than video or image, such as text or PDF files.

During initialization, assemblies in the bin folder are scanned for .NET classes decorated with the [ContentType] attribute, and inheriting from MediaData, ImageData or VideoData. Metadata for media is defined as properties on the media class, and can be edited from the edit view.

When uploading a file, the content type is resolved by the ContentMediaResolver in Optimizely.

The DAM for Optimizely connector comes preinstalled with 3 media types.
Digizuite.Episerver.Models.Media.Image
Digizuite.Episerver.Models.Media.Video
Digizuite.Episerver.Models.Media.DigizuiteFile

If there are multiple implementations of the same media type for a given file extension, either by the MediaData class or the MediaDescriptor class, then the content type is resolved by using the type which is loaded first during initialization. This means that it's random which content type the media gets. The three Digizuite media types cannot exist outside of the Digizuite folder area, which is why, if you upload a file to one of Optimizely’s folders, and the file has been resolved to use one of the Digizuite media types, then the upload is canceled and a notification is shown.

If you need to upload a file to one of the Optimizely folders, then you have to add a MediaDescriptor to your media type class and specify the extensions. Then your class will be used for the given file extensions.

Upload large file

By default in Optimizely the FileSizeLimit is 4mb. Which means that you cannot upload files larger then that to Digizuite. You can change this in your startup.cs class.

// Change the max file size when uploading, default is 4mb.
services.Configure<UploadOptions>(x => { x.FileSizeLimit = int.MaxValue; });