xforms:uploadAdded by IBM on August 8, 2013 | Version 1 (Original)
|Sets a button to attach a file to the form. The file is loaded directly into the XForms data model as base64 data. If the file is an image, you can use an xforms:output to display the file to the user.
This is equivalent to a button of type enclose, but does not allow multiple enclosures.
Table 1. xforms upload parameters
<xforms:upload single_node_binding mediatype="MIME type">
|single node binding||string||See Single node binding.|
|MIME type||MIME type||Filters the file types that the user can upload. This is a space delimited list of MIME types that are allowed.
To limit uploads to those image formats supported by XFDL, set this to:
|label text||string||Sets the text that the button containing the upload displays, as well as the default accessibility message for that button. If the button also has value or acclabel options, they will override this setting.|
|Alert, Hint, Help Setting||metadata||See Metadata sub-options.|
Example The following example show a button that uploads an employee assessment into the data model. This upload also copies the MIME type of the file and the file name to elements in the data model.
- An xforms:upload can only upload a single file. If you want to add multiple files to a form, you must create multiple upload buttons (or use custom XFDL constructs).
- The only way to display an uploaded file is through the xforms:output option. However, this option is limited to displaying text and image files.