Restrict Uploads Using File Extensions

This article demonstrates how to restrict file uploads based on file extensions.

Uploads can be restricted as follows:

Using SharinPix Permission Records

SharinPix Permission records consist of the Accepted file types parameter used to specify the type of files that can be uploaded to an album.

The Accepted file types parameter takes as a value the list of accepted file extensions separated by a semi-colon.

For example, to restrict uploads to .jpeg, and PDF files, the value will be as follows: .jpeg;application/pdf

circle-check

Using the upload_accept parameter in Apex Method

Online tokens can be used to restrict uploads based on file extensions using the upload_accept parameter that specifies the type of files that can be uploaded to an album.

For example, to restrict uploads to .png and .jpeg files, the value will be as follows:

'upload_accept' => new List <String> { '.png', '.jpeg' }

The following code snippet demonstrates how to generate an online token with the upload_accept parameter.

circle-check

Last updated

Was this helpful?