This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Struts and the fly likes Upload file and mail it Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Upload file and mail it" Watch "Upload file and mail it" New topic

Upload file and mail it

david wittenberg

Joined: Dec 12, 2006
Posts: 1

I wish to upload a file using struts (this is succesfull, in my action class i have a FormFile) now i want to email this file. How do i get from a FormFile to a File. Is there a way to get the absolute path from the FormFile, or is there another way so i can mail the uploaded file?

Thanks in advance

Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
Getting the file in the server is quite easy and using multipart mail API you can construct a multipart message body and send using the standard java mail api.

Rahul Bhattacharjee
LinkedIn - Blog
I agree. Here's the link:
subject: Upload file and mail it
Similar Threads
How to use FormFile?
Regarding Upload a file
Upload all the files in the directory to server
customization of Browse button in file upload
absolute path Formfile upload