1

I've deployed a web localhost, http://localhost:8080 and I included the following code to take a upload file.

    <form action="/action_page.php">
      <input type="file" id="myFile" name="filename">
      <input type="submit">
    </form>

I am trying to read file name and file path in the local web server in my javascript code. How can I get those two?

Nayana
  • 1,513
  • 3
  • 24
  • 39
  • Do these answer your question? https://stackoverflow.com/a/40439593/6548154 and https://stackoverflow.com/questions/15201071/how-to-get-full-path-of-selected-file-on-change-of-input-type-file-using-jav – A_A Dec 26 '21 at 17:01

1 Answers1

0

You can use the below function to get the name, file path, size, and some other information about the uploaded file.

const handleUploadClick = (event) => {
  const file = event.target.files[0]
  console.log(file) // returns an object
}
fsefidabi
  • 153
  • 1
  • 12