Read the attached file befor being saved

i’m using domino agent that is executed when webquerysave event fired,i want to get the attached file to read its data first befor being saved so i can control to save it or not,how can i do that