Java_Alert
Java_Alert

Reputation: 1179

FileUpload in Chrome giving some fake path value

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.

Upvotes: 5

Views: 18649

Answers (2)

Pranav
Pranav

Reputation: 95

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.

Upvotes: 0

Nandkumar Tekale
Nandkumar Tekale

Reputation: 16158

Chrome shows it for security purpose.

Also check this link on meta stackoverflow

Upvotes: 4

Related Questions