How to use the client File browser

rated by 0 users
This post has 1 Reply | 2 Followers

Top 50 Contributor
Posts 27
Points 85
markW Posted: Tue, Jan 30 2007 5:09 PM
I need to prompt the user to select a file from the client using the standard file browser,  and after they select a file,  open it, and read the contents (which will be XML). 
  • Filed under:
  • | Post Points: 0
Top 10 Contributor
Posts 241
Points 2,655

Here is some sample method code (client-side, Javascript) to open a file browser and read the selected file.  This code then attempts to apply the contents of the file (assuming it is AML) and returns either an error or record count.

var inn = this.newInnovator();
var fileName = top.aras.vault.SelectFile();
var aml = top.aras.vault.ReadText(fileName);
var resultItem = inn.applyAML(aml);
if (resultItem.isError()) {
 return "Error: " + resultItem.getErrorDetail();
} else {
 return "Success: " + resultItem.getItemCount() + " Items created";
}

  • | Post Points: 0
Page 1 of 1 (2 items) | RSS