I'd suggest you take a look into the SmartUpload class in Java, I understand it's a third party contribution.  POST's that have attachments have "parts" of their contents which are identified by their headers in the MIME type.  The logical thing to do is to loop through the several parts and identify the one that you are expecting.  If you are not exactly looking after specific code I'd suggest you consult the RFC's related to those types of contents in POST requests.  There you'll have the key you need.

Regards.