Right now, I get the last part of an URL to exclude the filename like this:
attachmentFileName = attachmentLink.split("/");
attachmentFileName = attachmentFileName[attachmentFileName.length-1];
it feels, as if I could do that in one statement only, but I can't figure out how. Not a big deal, but i think it can be done more elegantly.