6

Hi i have these codes to read the file the user has uploaded:

function readURL(input) {
  if (input.files && input.files[0]) {
    var reader = new FileReader();

    reader.onload = function(e) {
      $('#myImg').attr('src', e.target.result);
    }

    reader.readAsDataURL(input.files[0]);
  }
}

And the output is a whole chunk of data:

enter image description here

Is there any way i can get the path from the data? for example C:\Users\blackLeather\Desktop

If no,is there another way to get the image directory without having to add into another folder?

Kunal Mukherjee
  • 5,463
  • 3
  • 23
  • 47
Black Leather
  • 73
  • 2
  • 11

1 Answers1

8

Is there any way i can get the path from the data?

No. None at all. That information is not provided to the JavaScript layer by the browser, for security reasons.

T.J. Crowder
  • 959,406
  • 173
  • 1,780
  • 1,769