Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

Library

URL

Struts 2.0.x

Struts 2.1.x

Commons-FileUpload

http://commons.apache.org/fileupload/Image Removed

1.1.1

1.2.1

Commons-IO

http://commons.apache.org/io/Image Removed

1.0

1.3.2

If you are using Maven then you can add these libraries as dependencies in your project's pom.xml.

...

As mentioned in the previous section one technique for uploading multiple files would be to simply have multiple form input elements of type file all with different names. This would require a number of setter methods that was equal to 3 times the number of files being uploaded. Another option is to use Arrays or java.util.Lists. The following examples are taken from the Showcase example application that is part sample applications you can download at http://struts.apache.org/download.cgiImage Removed. For the Action mapping details see struts-fileupload.xml in the sample application download.

...

The struts.multipart.parser used by the fileUpload interceptor to handle HTTP POST requests, encoded using the MIME-type multipart/form-data, can be changed out. Currently there are two choices, jakarta and pell. The jakarta parser is a standard part of the Struts 2 framework needing only its required libraries added to a project. The pell parser uses Jason Pell's multipart parser instead of the Commons-FileUpload library. The pell parser is a Struts 2 plugin, for more details see: http://cwiki.apache.org/S2PLUGINS/pell-multipart-plugin.htmlImage Removed. There was a third alternative, cos, but it was removed due to licensing incompatibilities.