Explanation
DEXTUploadX5 supports four modes for file upload operation.
- ORAF (default): Sends all files to be uploaded in one request. When the upload is completed, the response data becomes one.
- OROF: Requests are made as many as the number of files to be uploaded. When uploading is completed, response data is generated by the number of files.
- EXTS: Same as OROF, but for large uploads, used when individual or all files are larger than 2 GB in size. (See the example of uploading a large file).
- AWSS3: Used to upload files to Amazon S3. (See the Amazon S3 file upload example.)
var dx = dx5.get("component-id");
// Set the upload mode to ORAF, OROF, EXTS, AWSS3.
dx.setUploadMode("ORAF");
// Uploading all local files.
dx.upload("AUTO");
// Uploading all selected local files.
dx.upload("SELECTED");
// Uploading all checked local files.
dx.upload("CHECKED");
If you upload a file by ORAF, you can get the uploaded file at once on the server side.
# Server-side
...
FileItem item = null;
for (MultipartFile file : x5.getDEXTUploadX5_FileData()) {
item = (FileItem)file;
if (item.isEmpty() == false) {
item.save();
...
}
}
...
When uploading a file by OROF, the server side requests one request per file.
# Server-side
...
// Because it is OROF, only one file form element is passed to the server.
FileItem file = (FileItem)x5.getDEXTUploadX5_FileData().get(0);
if (file.isEmpty() == false) {
file.save();
...
}
...
Clients can change the upload method with just a few settings, but the server side code can have a completely different configuration depending on the uploading method.
Example
|
|
|
DEXTUploadX5 does not send form data and virtual file information(deleted) to the server unlike our different client products, and only local resources are uploaded purely. Therefore, if you want to send an action to the server, such as a file deletion operation, you should use Ajax or Form submit instead of processing the upload.
|