How to retrieve the size of a file being uploaded using a!fileUploadField() sail

How to retrieve the size of a file being uploaded using a!fileUploadField() sail component on sail form and restricts the user to upload a file larger than a certain limit.

Is it correct that document(ri!file, "size") will work only when form is being submitted as document being uploaded is being saved on Appian DMS and not before if sail form is not being submitted

Attached a sail form snippet, need to capture the size being circle on form

Thanks !


OriginalPostID-141769

OriginalPostID-141769

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    @Abhinavg: If I understood your requirement clearly the below code can help you identify the file size before you save that to appian.
    saveInto:{
    a!save(local!FileSize,(a!fileUploadField(target:targetfolder,value:ri!fileToUpload,saveInto:ri!fileToUpload).uploadedDocumentSize))
    }
    use this local!FileSize variable in validation attribute to validate accordingly
Reply
  • 0
    Certified Lead Developer
    @Abhinavg: If I understood your requirement clearly the below code can help you identify the file size before you save that to appian.
    saveInto:{
    a!save(local!FileSize,(a!fileUploadField(target:targetfolder,value:ri!fileToUpload,saveInto:ri!fileToUpload).uploadedDocumentSize))
    }
    use this local!FileSize variable in validation attribute to validate accordingly
Children
No Data