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" });

This sample is handled by the servlet (CommonFileOpen class) for file download processing and is mapped to common-open.do in web.xml.

# Server-side					

FileDownload dextnj = new FileDownload();

response.setCharacterEncoding("UTF-8");
  
// Downloading the file in inline format. 
dextnj.download(request, response, target, target.getName(), "image/jpg", true);

Example