Opening a file

Home > Basic examples > Example 05

Explanation

The DEXTUploadX5 does not provide desktop program execution. Instead, you can open the destination in a new window if the file can be opened with a browser. In general, files that a browser can open are as image-specific.

The openable target must be a virtual file that has the value of the openUrl property.

var dx = dx5.get("component-id");

// The download web path must be present in the openUrl property. 
dx.addVirtualFile({ ... name: "bridge_509147.jpg", openUrl: "http://.../service/common-open.do?key=FID0001" });

If you have access to the web, you do not have to download it through the application.

However, if the target path is not directly accessible from the Web, you must use DEXTUploadNJ on the server side to create the file in inline format.

This sample is handled by the controller (FileServiceController class) for file download processing and is mapped to common-open.do.

# Server-side					

DEXTUploadNJFileDownloadView dextnj = new DEXTUploadNJFileDownloadView(target);
dextnj.setMime("image/jpg");
dextnj.setInline(true);
return new ModelAndView(dextnj);

Example