1

I am using below code for file browse to upload xlsx data in spotfire. But i am not able to get complete path of the file but getting c:\fakepath\filename

can't we get complete path dynamically by browsing file from any directory.

Can anyone one help on this.

<input id="file-input" style="width: 198px; height: 17px;" type="file" size="1">


var $contentField = $("#myContent > input").first();

function readSingleFile(e) {
var file = e.target.files[0];
if (!file) {
  return;
}
var reader = new FileReader();
reader.onload = function(e) {
  var contents = e.target.result;
          //Replace the newline with ":"
          //var replacedNL = contents.replace(/(?:\r\n|\r|\n)/g, "~");
  var myContent = document.getElementById('file-input').files[0].name;
          reader.readAsText

          setContent(myContent);
}
reader.readAsText(file);
}
function setContent(fileContent) {
try {
$contentField.val(fileContent);
$contentField.focus();
          $contentField.blur();
}
catch(err) {
  alert(err)
}
}
JanakiRam
  • 7
  • 1
  • 3
  • No you can not (at least in responsible browsers), and anyway even if you could, what would you do with this information? – Kaiido Sep 04 '18 at 02:09

0 Answers0