Using File Upload Fields
The CMS
In the CMS, when editing a form, a field type called "File Upload" is available. In its settings you can specify:
- Maximum file size: the limit (in megabytes(MB)) of the size of the files to be uploaded. Also please note that there might be a container (e.g, Tomcat) level limit configuration.
- File extensions: a comma separated list of allowed file extensions. If you don't want any limitations, the field should be empty.
The site
First, your HTML form element rendered by the default JSP template will have the POST method and the correct encoding type automatically:
<form method="post" enctype="multipart/form-data"> ... </form>
Second, your HST component (that uses (Configurable)MailFormDataBehavior) needs some extra property configurations:
Properties | Values |
Notes |
fileuploadEnabled | true | Enables the processing of uploads in the component. |
fileuploadMethod | filesystem or email | Choose either for saving uploaded files on file system or for adding them as attachment in a mail. |
fileuploadDirectory | /path/to/directory | In case of fileuploadMethod=filesystem, it's the directory saving files. The default path is "/tmp/hippo". |