0

How to get the brows and selected file's path using JavaScript

   DataUpload(FormParent) {

        const newupload_file = document.createElement('input')
        newupload_file.className = 'upload_data'
        newupload_file.type = 'file'
        newupload_file.name = 'file_name'
        newupload_file.style.display = 'block'

        newupload_file.addEventListener("change", function() {

            console.log(newupload_file)
            for (var i = 0; i < newupload_file.files.length; i++) {
                console.log(newupload_file.files[i].name);
            }
        }, false);

        FormParent.append(newupload_file)

    }

I am not able to get the file path, the property I can only get the file name here.

Brian Tompsett - 汤莱恩
  • 5,438
  • 68
  • 55
  • 126
jax
  • 3,533
  • 4
  • 36
  • 61
  • 1
    Does this answer your question? [How to get full path of selected file on change of using javascript, jquery-ajax?](https://stackoverflow.com/questions/15201071/how-to-get-full-path-of-selected-file-on-change-of-input-type-file-using-jav) – bigless Jan 24 '22 at 22:25

0 Answers0