Skip to content

SDK API Reference / validateMediaUploadExtension

Function: validateMediaUploadExtension()

validateMediaUploadExtension(filePath): SDKError | undefined

Validates that filePath has an extension Engage DAM accepts for upload.

Pure: derives the extension from the path string only, with no filesystem access, so it is testable without mocks.

Parameters

filePath

string

Path to the file being uploaded. Only its extension is read.

Returns

SDKError | undefined

An SDKError with ErrorCode.INVALID_ARGUMENT when the extension is unsupported, or undefined when it is accepted.