Explanation
Meta-data is additional data expressed in the form of'key=value' and can be held for each file. (From version 3.2.0.0, the IE module can have meta-data only for local files.)
To register the meta-data, register the key and value using the index(order) of the local file.
var dx = dx5.get("component-id");
// Returning the value for the "user" key in the meta-data of the 6th item.
var userValue = dx.getMetaDataByIndex(5, "user");
// Setting the value for the "user" key in the meta-data of the 6th item to "ABC".
dx.setMetaDataByIndex(5, "user", "ABC");
// Deleting the "user" key in the 6th item's metadata.
dx.deleteMetaDataByIndex(5, "user");
The meta-data is passed to the server when the local file is uploaded.
In server-side code, the "DEXTUploadX5_MetaData" is passed as the form name, so meta-data can be obtained from the form data.
The meta-data passed to the form name("DEXTUploadX5_MetaData") follows the order of the uploaded file.
# Server-side
List<MultipartFile> items = x5.getDEXTUploadX5_FileData();
List<String> metadata = x5.getDEXTUploadX5_MetaData();
for (int i = 0, len = items.size(); i < len; i++) {
file = (FileItem)items.get(i);
form = metadata.get(i);
if (file.isEmpty() == false) {
file.save();
// Write the meta-data and the location of the saved file in the response data buffer.
sb.append(String.format("F:%1$s, M:%2$s\n", file.getFilename(), form));
}
}
...
If there are multiple meta-data for a single file, the meta-data that is passed to the server as the "key1[SPLT]value1[SPLT]key2[SPLT]value2[SPLT]key3[SPLT]Value3" format, not the "key1=value1[SPLT]key2=value2[SPLT]key3=value3" format.
To obtain the data, separate the tokens with the string "[SPLT]", use the odd-numbered keys as the key, and the even-numbered as the value.
Example
Meta-data applies only to local files. (Add a local file to test)