File upload validation

I'm using the following code to validate a user uploaded file : 

 

a!gridRowLayout(
id: ri!index,
contents: {
if(
ri!index > ri!oldAttachments,
a!fileUploadField_17r1(
label: "file upload " & ri!index,
target: ri!target,
value: ri!attachments[ri!index],
saveInto: ri!attachments[ri!index],
validations:{
if(
or(
find("JPG", a!fileUploadField(value: ri!attachments)),
find("JPEG", a!fileUploadField(value: ri!attachments)),
find("PNG", a!fileUploadField(value: ri!attachments)),
find("ICO", a!fileUploadField(value: ri!attachments)),
find("GIF", a!fileUploadField(value: ri!attachments)),
find("BMP", a!fileUploadField(value: ri!attachments))
)>0,"Invalid Format",{}

) } 

 

... 

 

but it gives an error in a!for Each() while uploading another file 

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data