NG Client - showFileOpenDialog inconsistent filename

Questions and answers on developing, deploying and using plugins and JavaBeans

NG Client - showFileOpenDialog inconsistent filename

Postby Louis.Winter » Thu Dec 13, 2018 9:56 pm

I am trying to use plugins.file.showFileOpenDialog to allow the user to upload an Excel (.xlsx) file. The problem I am having is that some files return a full path in the JSFile object passed to my callback method, and others have just a filename.

Examples:
Uploading Good.xlsx results in a JSFile object of:
JSFile[name:C:\Users\XXXXX\AppData\Local\Temp\upload_44f920dc_525e_423b_92cc_8463bb48868e_420537147.tmp,contenttype:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet]

Uploading Bad.xlsx results n a JSFile object of:
JSFile[name:Bad.xlsx,contenttype:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet]

Both of the files open correctly in Excel.

Also, I have a download option to create an Excel file which works correctly. The file created by scopes.svyExcelUtils.createWorkbook won't upload because the JSFile object is just a name and not the full path to the temp file.

The following shows what I'm currently doing.
Code: Select all
function onAction$Upload(event) {
   plugins.file.showFileOpenDialog(1,null,false,new Array("Excel Files", "xlsx"),onUpload,'Select Spreadsheet to Upload');
}

function onUpload(files) {
   application.output(files[0]);
   var wb = scopes.svyExcelUtils.getWorkbook(files[0]);
   /* The getWorkbook call works for the first file and not for the second. */
}


Thoughts?

Louis Winter
Louis Winter
Journey Technology Solutions
Sioux Falls, SD USA
Louis.Winter
 
Posts: 24
Joined: Thu Dec 13, 2018 8:10 pm

Return to Plugins and Beans

Who is online

Users browsing this forum: No registered users and 11 guests