0

Getting "C:/fakepath" for selected directory. So can anyone please help me to get the selected directory.

var dialogElement = document.createElement('dialog');
dialogElement.style.width = '80vw';
dialogElement.style.height = '30vh';
dialogElement.setAttribute("id", "test");

document.getElementById('ExportIntermediateForm').appendChild(dialogElement);

$('dialog').html(
    `<label>Select Directory</label>
     <input type="file" id="directorySelector" onchange="FilePath()" webkitdirectory directory multiple />
     <p id="path"></p>`
);


dialogElement.showModal();

function FilePath() {
     console.log("Here I need selected directory");
}
ButchMonkey
  • 1,648
  • 13
  • 23
Sahil Shikalgar
  • 561
  • 5
  • 18

1 Answers1

-1

You can use electron window for this. You can directly get path using input type file if you use electron windows dialog.

Sahil Shikalgar
  • 561
  • 5
  • 18