5

I am trying to upload a file in Chrome then it is giving some fakepath value.for eg. It is giving file name like "C:\fakepath\Hi.txt" .Could you please explain me why it is coming? In other browsers it is working fine.

Java_Alert
  • 1,159
  • 6
  • 24
  • 50

2 Answers2

3

Chrome shows it for security purpose.

Also check this link on meta stackoverflow

Community
  • 1
  • 1
Nandkumar Tekale
  • 16,024
  • 8
  • 58
  • 85
0

You can't do that. Its for security purposes that you can't get actual physical path of the uploaded file.

 document.getElementById("yourFileInput").files[0].fileName;

this will get you the filename from uploaded path.

Pranav
  • 85
  • 1
  • 2
  • 11