Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated information about error messages

...

Code Block
langnone
struts.multipart.parser=jakarta
struts.multipart.saveDir=
struts.multipart.maxSize=2097152
Note

Please remember that the struts.multipart.maxSize is the size limit of the whole request, which means when you uploading multiple files, the summary of their size must be below the struts.multipart.maxSize!

In order to change theses settings you define a constant in your applications struts.xml file like so:

...

Error Key

Description

struts.messages.error.uploading

A general error that occurs when the file could not be uploaded

struts.messages.error.file.too.large

Occurs when the uploaded file is too large as specified by maximumSize.

struts.messages.error.content.type.not.allowed

Occurs when the uploaded file does not match the expected content types specified

struts.messages.error.file.extension.not.allowed

Occurs when uploaded file has disallowed extension

struts.messages.upload.error.SizeLimitExceededException

Occurs when the upload request (as a whole) exceed configured struts.multipart.maxSize

struts.messages.upload.error.<Exception class SimpleName>

Occurs when any other exception took place during file upload process

Temporary Directories

All uploaded files are saved to a temporary directory by the framework before being passed in to an Action. Depending on the allowed file sizes it may be necessary to have the framework store these temporary files in an alternate location. To do this change struts.multipart.saveDir to the directory where the uploaded files will be placed. If this property is not set it defaults to javax.servlet.context.tempdir. Keep in mind that on some operating systems, like Solaris, /tmp is memory based and files stored in that directory would consume an amount of RAM approximately equal to the size of the uploaded file.

...