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
Hi Mike, this .contents.name solution does not work in 18.1. Has Appian changed these values? Or if you could tell where to find these properties.
My requirement is to capture the uploaded file's name; once the user uploads a file, and simultaneously display that name in an adjacent textfield. How do I achieve this?
Thanks!
Since it looks like someone recently asked this question again, the behavior listed in this discussion thread is not supported. In 17.2, a new version of the File Upload component was released where you can validate on file size, extension, and name using fv!files in the validations field. Please see the documentation for the File Upload field for more information and several examples of validations:
https://docs.appian.com/suite/help/latest/File_Upload_Component.html
Hi Peter,
I am aware about the new version of file upload field where we can access names, extensions, etc via fv!file variable but these can be accessed only inside fileNames, fileDescriptions and validations.
My requirement is to capture the uploaded file's name; once the user uploads a file, and simultaneously display that name in an adjacent textfield. How do I achieve this? Let me know if you know of any workaround.
The original (unsupported) functionality as discussed earlier in this thread still works as far as I know, though several versions ago the internal properties were changed around slightly and now need to be addressed differently.
If Appian wishes us to no longer need to use this unsupported functionality, all they would need to do is allow the fv!file properties to be accessed inside the saveInto parameter, allowing designers to capture name, extension, and size properties as needed into local variables and/or rule input variables, but for some reason this was not included when they implemented the same functionality within the validations parameter etc.
Well, I found a solution to my problem!
I replaced the new fileUpload version with 17.1 version and it worked just fine.