I'm using <lightning:input ... type="file"> to allow file upload on the UI. Is there any way I could make it optional in the component itself? instead of taking care of the check completely in the controller.

1 Answer 1


lightning:input type="file" is optional by default. You would need to set the required attribute to true in order for the file upload to be required.

If you want the file upload to be required under certain circumstances there are some things you could do within your Aura component to make that happen but without knowing your requirements I can only speculate on them here.

  • right ok. This cleared my doubt. thank you Commented Sep 14, 2020 at 15:16

Not the answer you're looking for? Browse other questions tagged .