QuestionQ42

VerifiedDeveloping with Admin

An Adobe Commerce developer is required to add a file field to a custom form in the Administration panel. The field must accept only .PDF files with a size less than or equal to 2 MB. So far, the developer has added the following code in the form component XML file, within the fieldset node:

Question Image

How should the developer implement the validations?

Explanation

Adobe Commerce’s FileUploader UI component supports the allowedExtensions setting to restrict permitted extensions and maxFileSize to set the maximum upload size in bytes. Configuring these in the component’s fileUploader settings with pdf and 2097152 enforces the required PDF-only, 2 MB limit in the uploader configuration.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!