Get the file path from an input


#1

Is there a way to get the file path of a file when I use a <input type='file/>? I tried using the .val() property but my output is: C:\fakepath\test.md.
How can I work around this??

Thanks


#2

Electron adds a path property to File objects, so you can get the real path from the input element using:

document.getElementById(“myFile”).files[0].path


#3

Hi @enlight I am new to Atom scripting, how do one implement this?

I have around 100 files, I want to add the file path to the document in one go, can this be achieved?

Thanks


#4

Are you asking about Atom, or Electron? Because if you’re asking about Atom, that’s a different question than the original purpose of this thread and you should start a new one. You also need to explain a bit more about what you want to see.


#5

Apologise @DamnedScholar,

I have created a new topic

Thanks