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.
Asked
Active
Viewed 1.7k times
5
-
How does this question relate to Java? – Peter Lawrey Aug 10 '12 at 07:48
-
Why do you care for exact path anyway on server? – Akash Kava Aug 10 '12 at 07:49
-
@PeterLawrey done the required changes. – Java_Alert Aug 10 '12 at 08:56
-
@Akashkava I want to remove it to make my code error free and I want to know why the path coming like this. – Java_Alert Aug 10 '12 at 08:57
-
You are supposed to just ignore the path and use file name. – Akash Kava Aug 10 '12 at 10:00
-
@AkashKava thanks for useful comment.Now doing same thing. – Java_Alert Aug 10 '12 at 10:20
2 Answers
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