commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tony Yat-Tung Cheung <>
Subject Using FileUpload to send an e-mail with attachment with JavaMail
Date Thu, 26 Feb 2004 10:01:00 GMT

I am trying to make a servlet to receive a file with FileUpload, and 
then send out an e-mail with the received file as an attachment.

The FileItem does not provide a way to get a DataSource out of it, which 
is required by the JavaMail's MimeBodyPart.

Is there any way?

The FileItem's API documentations seem to hint the solution, but I do 
not quite get the idea.
"While this interface does not extend javax.activation.DataSource per se 
(to avoid a seldom used dependency), several of the defined methods are 
specifically defined with the same signatures as methods in that 
interface. This allows an implementation of this interface to also 
implement javax.activation.DataSource with minimal additional work."

Do we have an easy solution here? I think it is one of the common 
applications of the commons-fileupload.

Thank you very much.

Best Regards,
Tony Cheung

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message