Validation of files/attachments

1
0
-1

Hi.

I have a form that allows a user to upload attachments.

I need to validate the attachments so that they are:

  • Only 5MB or less
  • Are only of the format .jpg, .pdf or .png.

I'm not sure how to put these constraints into effect. Can anybody please guide me. Thank you.

1 answer

1
+1
-1
This one is the BEST answer!

Hello,

There is no mechanism on this way natively.

What you can do is:

1/ when you instantiate the case, you can have an operation to check your constraints

2/ you can too build a fake variable. In the initialization of this variable, check files (file names are in the contract). If the result does not match your requirement, then throw an exception.

Best,

Notifications