fileUploadField - remove added files

Came across an issue with fileUploadField and empty files. When a new file is added to the control and saved into say rii!files, and then removed, seems that it will be uploaded anyway once the form is submitted. Setting ri!files to null doesn't help either.  I do see a note in Appian docs on the file upload control that files will need to be deleted or reverted in the target in a cancellation scenario. However, our issue is that if an empty file is added, even if it is removed from the control, upon submission we get " Could not upload “file name”. Reason: This file is empty." error, and there is no way to get out of it. The fact that non-empty files are being uploaded even if they are removed before submitting is still an issue, but we can handle that.

I tried adding validation to the upload to stop users from uploading empty files, without luck.

    a!fileUploadField(
      label: "File Upload",
      labelPosition: "ABOVE",
      target: cons!TEST_FOLDER,
      saveInto: ri!files,       
      validations: if(or(fv!files.size =0),"Attachments cannot be empty", "")
    ),

Any ideas how to handle the empty files? We're using 19.1 for a few more days, going to 19.3 this weekend, in case it makes a difference.

Thanks.

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Lead Developer
    in reply to Stefan Helzle

    I also recently found that a similar error occurs if an uploaded filename contains a standard "%" character, even though this character is allowed to be in filenames both in Windows as well as in Appian.  It produces a generic error message that can't be cleared (as the uploaded document disappears as soon as the error comes up, with no way of removing it).  I assume the root cause isn't necessarily related to the issue of zero-size files, but the behavior has an eyebrow-raising amount of overlap.  I have a support case open for this already FWIW.

Children
No Data