I have discovered something and would like to share it with the community, while at the same time would like to know if this is "safe" to be used, or whether the slightest code change in Appian might cause it to misbehave.A way of validating the uploaded file before submitting it, like validation on extension, file size, file name...etc.When searching in the forum, the answer is: "it is not possible to be done without actually submitting the form and doing the checks after submitting."But I have found a way to get it to work, and below is the method:In the validation of the upload fileUploadField, call the object a!fileUploadField, passing the variable "value:ri!MainImage", assuming you are saving into "ri!MainImage" and then calling any properties like "uploadedDocumentName" as needed. This has worked for me perfectly.Below is a code snippet:a!fileUploadField( label: "Main Image", labelPosition: "ADJACENT", ...
OriginalPostID-153370
Discussion posts and replies are publicly visible
Everyone interested in this functionality, please reference the attached expression rule which should now handle the new 17.1 file upload field properties at the same time as the old rendering style.This rule accepts a rule input of type Document (ri!document), and will return a data dictionary consisting of 4 properties: "fullName" (name.ext), "name" (just name without extension, if any), "ext" (just extension, if any), and "size" (text-based abbreviated filesize - i.e. "44 kb", "2 mb", etc). The four properties are returned blank if no input or invalid input is passed, to ensure it's safe to use even when no file is uploaded yet.I've tested this in 17.1 (in an actual task form) as well as in interface designer in 17.1 and 16.3, and it seems to work as desired, though any feedback is welcomed.
[removed download - newer version in subsequent comment]