When both Allowed-formats
and Format
parameters are specified in an upload preset, their behavior differs from when they are used separately.
Default Behavior
- If
Allowed-formats
is set, only those formats are whitelised for upload (e.g., ifjpg
is set for this field, onlyjpg
files can be uploaded ). Otherwise, any format can be used. - If
Format
is set (e.g.,jpg
), all uploaded files—regardless of their original format—will be automatically converted to the specified format upon upload (i.e.,jpg
here).
Modified Behavior
When both Allowed-formats
and Format
are defined, their functionality changes:
Allowed-formats
acts as a whitelist, allowing only the specified formats to be uploaded. Any format not included will be rejected.Format
applies only to files not included in theAllowed-formats
list. These files will be converted to the format specified in theFormat
parameter.- Files with formats included in the
Allowed-formats
list will be uploaded as-is, preserving their original format.
Summary
Allowed-formats
restricts which file types can be uploaded.Format
(when combined withAllowed-formats
) only converts files that don’t match the allowed formats. Allowed file types remain unchanged.
Comments
0 comments
Please sign in to leave a comment.