Servlet and attachments

So far, I have been able to:

Create an upload form, copy the attached image to another document using CopyAllItems

Create an agent that runs on the server that takes that image and creates a stream, resizes the images and copies the streams back to the document into succinct fields - an import vs. an attach. I had to do it this way due to server security - cannot write a file.

Now, I want to attach those resized images to the main Body field. I have tried using a MIMEEntity but the folder does not show up. How would I do that?