Uploading by ORAF/OROF

Home > Basic examples > Example 03

Explanation

DEXTUploadX5 supports four 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					
...
dextnj = new FileUpload(request, env);  

// Store all the file data part from the data sent from the client as a temporary file. 
// Temporary save location is set by Environment # setTempRepository method.
dextnj.prepare();  

// You can call them one by one using the FileUpload # getFileItem method, but you can get the collection object using the getFileItems method.
List<FileItem> items = dextnj.getFileItems();

// Get the uploaded mode file at once using the same loop statement for.
FileItem file = null;
for (int i = 0; i < items.size(); i++) {
	file = items.get(i);
	if (file.isEmpty() == false) {
		file.save();
		...
	}
}
...

When uploading a file by OROF, the server side requests one request per file.

# Server-side					
...
dextnj = new FileUpload(request, env);		
	
dextnj.prepare();

// Because it is OROF, only one file form element is passed to the server.
FileItem file = dextnj.getFileItem(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.