Apache » Cocoon »

  Cocoon Forms

Cocoon Forms 1.0

Upload widget


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:


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


<fd:upload id="..." mime-types="text/plain, text/xml" required="true|false" state="...">
    <fd:attribute name="..." value="..."/>

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.


An upload widget is inserted in a template using the ft:widget tag:

<ft:widget id="..."/>

Styling (default HTML XSL)

The upload widget is rendered as a default HTML upload control.

Errors and Improvements? If you see any errors or potential improvements in this document please help us: View, Edit or comment on the latest development version (registration required).