Explanation
DEXTUploadX5 supports three 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 it is used when individual or all files are larger than 2GB. (See "Uploading large files".)
- 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
using (var dext = new DEXTUpload.NET.FileUpload())
{
...
// You can get an uploaded file list object using the GetFileElements method.
foreach (var element in dext.GetFileElements("DEXTUploadX5_FileData"))
{
if (!element.IsEmpty)
{
// Save the file.
element.Save();
...
}
}
...
}
When uploading a file by OROF, the server side requests one request per file.
# Server-side
using (var dext = new DEXTUpload.NET.FileUpload())
{
...
// You can get the uploaded file using the GetSingleFileElement method.
var element = dext.GetSingleFileElement();
if (!element.IsEmpty)
{
// Save the file.
element.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.
|