@Member will do it all for you in a more compact manner. Your code could be changed to:
posNum := @Member(fileName; @AttachmentNames);
imgTitle := @If(posNum = 0;
I’m assuming that the variable fileName is valid here.
If fileName is a member of @AttachmentNames (which is a list…you don’t have to @Explode it), then @Member returns the number within the list, or else it returns 0. The reason why you were getting all 0′s is because you @Implode(d) the list of @AttachmentNames translating it from a list to a string.
Hope this helps.