Skip to main content
bisheswart9459
May 23, 2024
Question

document upload check

  • May 23, 2024
  • 2 replies
  • 0 views

There is a smart service in my interface known as document upload . When i am uploading any document , it should be in pdf or word format , basically I need to check that User can only upload a pdf or word document . If the user uploads document of different type it should throw the error . 

how to achieve this please explain or give some code snippet if possible .

Thanks in advance !

    2 replies

    venkatrea696188
    May 23, 2024

    you can refer uploaded files using fv!files in validations Use it. 

    https://docs.appian.com/suite/help/24.1/File_Upload_Component.html#all-files-must-be-pdfs  go though this.

    Participating Frequently
    May 23, 2024

    Hi, you can use this in validation.

    a!localVariables(
            local!invalidExtensions: difference(upper(fv!files.extension), {"PDF","DOCX"}),
            if(
              length(local!invalidExtensions) > 0, 
              "Attachments must be pdf or word files. Remove: " & 
              index(fv!files, "name", wherecontains(local!invalidExtensions, upper(fv!files.extension)), {}), 
              ""
            )
          )