Uploading by ORAF/OROF

Home > Basic examples > Example 03

Explanation

DEXTUploadX5 supports three modes for file upload operation.

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.