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
    I mainly use this to validate proper extension, as i've had requirements that certain file types not be allowed. I should note that this is not "officially" supported functionality, as in, there is no guarantee that the property names won't change in between appian versions, among other things. As such, I strongly suggest that you create external rules to handle taking the temporary document and extracting the name - that way if something ever changes, you only need to update your hanler rule(s) instead of any forms that used the literal property names.

    Also just be cautious about using this for just-uploaded files in a grid; this makes it possible but at the same time, you're still going to be dealing with an array of "temporary" document IDs that don't become permanent ones until submit time. I'd strongly recommend continuing to submit the form between uploads, unless you have strong reasons not to.
Reply
  • 0
    Certified Lead Developer
    I mainly use this to validate proper extension, as i've had requirements that certain file types not be allowed. I should note that this is not "officially" supported functionality, as in, there is no guarantee that the property names won't change in between appian versions, among other things. As such, I strongly suggest that you create external rules to handle taking the temporary document and extracting the name - that way if something ever changes, you only need to update your hanler rule(s) instead of any forms that used the literal property names.

    Also just be cautious about using this for just-uploaded files in a grid; this makes it possible but at the same time, you're still going to be dealing with an array of "temporary" document IDs that don't become permanent ones until submit time. I'd strongly recommend continuing to submit the form between uploads, unless you have strong reasons not to.
Children
No Data