This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts  FormFile to java.io.File Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts  FormFile to java.io.File" Watch "Struts  FormFile to java.io.File" New topic
Author

Struts FormFile to java.io.File

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 java.io.File 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:

 
GeeCON Prague 2014
 
subject: Struts FormFile to java.io.File