I need get the path of file when i select a file excel (for example) from item type input into toolbar.
how can I do ? Can you help me? I use Version 8 Pro
This is code for item into toolbar:
var elemtItem = {
type: 'file',
attrFile: "id='import_file' accept='.xls,.xlsx,.csv' title='Import Data from Csv or Xlsx'",
icon: 'ui-icon-folder-open',
style: 'margin-right:0;margin-left:1px;',
listener: function (evt) {
//import xlsx or csv file via HTML5 file input control.
var grid = this,
file = evt.target.files[0];//doesn't work in IE9.
//var pippo = `${file.webkitRelativePath}`;
//pippo = Server.MapPath("~");
//console.log(pippo);
if (file) {
console.log(file);
var tmppath = URL.createObjectURL(event.target.files[0]);
console.log(tmppath);
var filePath=$('#import_file').val();
console.log(filePath);
var path = (window.URL || window.webkitURL).createObjectURL(file);
console.log('path', path);
grid.showLoading();
//import first sheet of xlsx into workbook.
pq.excel.importXl({ file: file }, function (wb) {
//grid = grid.Tab().main();//always import in main tab.
//import workbook into grid.
console.log(wb);
//grid.importWb({ workbook: wb, extraRows: 0, extraCols: 0 });
grid.hideLoading();
})
}
}
};
This is response:
File {name: 'CheckFornituraOpzioniRESNORES_more365gg_al20231129.xlsx', lastModified: 1701246539432, lastModifiedDate: Wed Nov 29 2023 09:28:59 GMT+0100 (Ora standard dell’Europa centrale), webkitRelativePath: '', size: 10380, …}lastModified: 1701246539432lastModifiedDate: Wed Nov 29 2023 09:28:59 GMT+0100 (Ora standard dell’Europa centrale) {}name: "CheckFornituraOpzioniRESNORES_more365gg_al20231129.xlsx"size: 10380type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"webkitRelativePath: ""[[Prototype]]: File
frmTestGrigliaShunt_retevera.html:124 blob:null/78241890-abd0-4664-8ca5-663ea8270ebe
frmTestGrigliaShunt_retevera.html:126 C:\fakepath\CheckFornituraOpzioniRESNORES_more365gg_al20231129.xlsx
frmTestGrigliaShunt_retevera.html:128 path blob:null/32652fb3-6c0f-45fc-821b-e2bdada8321a
frmTestGrigliaShunt_retevera.html:134 {sheets: Array(1), activeId: null}