jQuery in Action, 3rd edition
The moose likes Struts and the fly likes How can I upload a File using Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How can I upload a File using Struts" Watch "How can I upload a File using Struts" New topic

How can I upload a File using Struts

Rakesh Narayanan

Joined: Sep 07, 2004
Posts: 1
How can I upload a File using Struts
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
With <html:file/>. You need to use the <html:file/> element inside a <html:form/> on the JSP and have a corresponding setter/getter in your ActionForm class with the type org.apache.struts.upload.FormFile.

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Sean Sullivan
Ranch Hand

Joined: Sep 09, 2001
Posts: 427
I wrote a Struts application that demonstrates File Upload and File Download:



George Franciscus
Ranch Hand

Joined: Jan 25, 2005
Posts: 32
Check out Struts Recipes, chapter 2, recipe 2.9, Upload a File, p 89 (p 51 in the pdf). This recipe explains how to do it and "gotcha"s.



George Franciscus<br />george.franciscus@nexcel.ca<br /><a href="http://www.nexcel.ca" target="_blank" rel="nofollow">http://www.nexcel.ca</a><br /><a href="http://www.manning.com/franciscus" target="_blank" rel="nofollow">http://www.manning.com/franciscus</a>
I agree. Here's the link: http://aspose.com/file-tools
subject: How can I upload a File using Struts
It's not a secret anymore!