Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Verified Answer
Replies
7 replies
Subscribers
7 subscribers
Views
7231 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
User Interface
File Upload Validation
tanvirs
over 8 years ago
How to put a Validation on a file upload field so that the user could only upload images.
OriginalPostID-249057
Discussion posts and replies are publicly visible
0
Shashank
over 8 years ago
@tanvirs
Hi
In case you haven't had a chance , please have a look at the following entry
/search?q=OriginalPostID-153370
You can use the above as a start and mention the extensions which might be related to images in the validation to support your requirement
Hope this Helps !!
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Krishna Chaitanya
A Score Level 1
over 8 years ago
images with jpg extensions use this code
if(
exact(
right(ri!name,3),
"jpg"
),
{},
"Only jpg file extensions are allowed"
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
tanvirs
over 8 years ago
thanks to both of u
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
+1
aloks0189
Certified Lead Developer
over 8 years ago
@tanvirs , you can do something as below
=======================================================
a!formLayout(
firstColumnContents: {
a!fileUploadField(
label: "Upload a File",
labelPosition: "ABOVE",
saveInto: ri!document,
validations: {}
)
},
secondColumncontents:{
},
buttons: a!buttonLayout(
primaryButtons: a!buttonWidgetSubmit(
label:"Submit",
style: "PRIMARY"
)
),
validations:{
if(
or(
find("jpg", a!fileUploadField(value: ri!document)),
find("jpeg", a!fileUploadField(value: ri!document)),
find("png", a!fileUploadField(value: ri!document)),
find("ico", a!fileUploadField(value: ri!document)),
find("gif", a!fileUploadField(value: ri!document)),
find("bmp", a!fileUploadField(value: ri!document))
)>0,"Invalid Format",{}
)
/* if(
find("jpg", a!fileUploadField(value: ri!document))=0,{},
"Invalid Format"
)*/
}
)
==========================
Hope this will help you
Cancel
Vote Up
0
Vote Down
Sign in to reply
Reject Answer
Cancel
0
Shashank
over 8 years ago
@tanvirs
No Worries .. :)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
tanvirs
over 8 years ago
@aloks176 it worked thanks :)...
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
aloks0189
Certified Lead Developer
over 8 years ago
Happy to help
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel