apache > cocoon
 
Font size:      

Cocoon Forms: upload widget (2.1 legacy document)

Warning
This document was copied as is from the Cocoon 2.1 documentation, but has not yet been fully reviewed or moved to its new home.

Concept

This widget allows to upload files by using Cocoon's file upload features. For this reason, this widget won't function properly unless enable-uploads is set to true in WEB-INF/web.xml.

Also, don't forget to put the enctype attribute as multipart/form-data in the ft:form-template element, inside the template file.

To retrieve the uploaded data, simply use the getValue method of the widget, which will in this case return an object of the following type:

org.apache.cocoon.servlet.multipart.Part

The setValue method cannot be used with the upload widget.

The uploaded data will be automatically cleaned up when the upload widget instance object is finialized by the JVM.

Configuration

<fd:upload id="..." mime-types="text/plain, text/xml" required="true|false">
  <fd:label>...</fd:label>
  <fd:help>...</fd:help>
  <fd:hint>...</fd:hint>
</fd:upload>

The optional mime-types attribute allows to specify a comma-separated list of mime-types which are accepted. The widget will be invalid if the uploaded type isn't of one of the specified content types.

Comments

add your comments