Runtime components : Channels components : AJAX channel : Concepts : AJAX file upload request overview : File upload data
  
File upload data
File upload data is contained in an operation context or a session context to enable other operations to access the file when the file upload request is complete.
File upload data must contain the following three elements:
An ID: The identifier is required to retrieve the file upload data. In this example, the ID of the file upload data is specified in the kColl tag as userImgs. The ID is the default dataName of the FileUpload widget to which the data is bound.
A field to store file info, operation can access file info to retrieve file. e.g. in the below sample it use a refData file to save file info. File handler will know how to write and read the file info.
There must be a field named handler, the value is the handler IDthat is defined in the btt.xml file.
Note that when an alpha developer creates a file handler and configures a FileUpload widget that is associated with the file handler, the structure of the file upload data must be the same as the structure of the file handler.
Note The file upload data definition must align with specific file handlers. E.g. in the sampleFileHandler class, it will need to get file info by key “file”, and update file into two field: fileId and name.
Example file upload data
<!-- data for a file uplaod -->
<!-- a file info with name 'file' is mandatory, fileId field is
mandatory developers can add more other file info here -->
<kColl id="file">
<field id="name" />
<field id="size" />
<field id="fileId" />
</kColl>
<kColl id="userImgs">
<!-- latest upload file, this item is mandatory -->
<refDatarefId="file" />
<!-- if there more than one file is uploaded, information of the
other uploaded files is added to the receivedFiles area -->
<iColl id="receivedFiles">
<refDatarefId="file" />
</iColl>
<!-- The file handler that handles the file upload request. This field mandatory -->
<field id="handler" value="sampleFileHandler" />
</kColl>
Go up to
AJAX file upload request overview