Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Prevent Zip File Attachments

Avatar

Level 9

I have an atachment interface on my form that allows the user to click a custom button labeled, "Attach New File". The script opens a browse window and the user is able to select and attach a file they select. I would like to prevent the user from being able to attach .zip files because Acrobat will not open them. How can I test the file they select and not attach it if it is a .zip file? Here's the script:

Capture.JPG

2 Replies

Avatar

Level 7

I do not think there is any built in way to do this. However, you could read the incoming data and test for a ZIP file header.

http://www.pkware.com/documents/casestudies/APPNOTE.TXT

Avatar

Level 9

Thank you for your reply. It's interesting that when you drag and drop a .zip file into the atachments pane a pop-up message appears but not when you attach the same file using script.

Message.jpg

Regarding your suggeation, any idea what the script would be to "...read the incoming file header"?

Thanks