This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
On the server side : You need two jar files -- mail.jar & activation.jar
U will have to use MimeMultiPart ---- javax.mail.internet.MimeMultipart which takes javax.activation.DataSource in the constructor. You will have to provide the implementation of this datasource.
1. Get the count on MimeMultiPart which tells the total files uploaded. 2. Call getBodyPart(index i) . 3. BodyPart has the api's like getFileName(), getInputStream() which is the content of the part for ex. image file. 4. Now you have to create a file on the server and transfer this inputstream of the bodypart into the newly created file.
I wouldn't use the mail classes to upload the file... I'd use a separate set designed especially for uploads. Two that come to mind are the jakarta commons upload classes, and a set from O'Reily (think they're by Jason Hunter, the same person who wrote their servlet book).