File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Struts  FormFile to Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts  FormFile to" Watch "Struts  FormFile to" New topic

Struts FormFile to

Tim Storms
Ranch Hand

Joined: Apr 27, 2006
Posts: 64
Hi all,

In my application, people have to select a file (a struts FormFile) in a form. After the file was submitted, it should be send as an attachment in a mail. I'm using the Javamail package to send mails.

The problem I'm facing is that I can't cast the FormFile to a which is needed by the JavaMail package. Do you have any idea how to do that?

Here's the code I use to attach a file to a mail:

[ October 09, 2006: Message edited by: Tim Storms ]

SCJP 1.5, SCWCD 1.4, SCBCD 5
Tim Storms
Ranch Hand

Joined: Apr 27, 2006
Posts: 64
I've been to fast. Here's the solution:

Consider Paul's rocket mass heater.
subject: Struts FormFile to
Similar Threads
java mail attachment notification
Sending a X509Certificate with JavaMail attachment
Multiple Attachment
how to send mail using gmail server
What should be the value of 'host' when I send an e-mail?