User12341234
User12341234

Reputation: 79

How to read the contents of a file selected by an `<input type="file">` element?

I have a simple HTML form, where I have a field with a browse button for uploading local files.

<input type="file" id="FilePath" name="FilePath" size="18">

When fetching the uploaded file's path, it is showing as C:/fakepath/filename.xls. I came to know that it is the browser security that is not allowing to read exact file path from the local computer.

Is there any way that I can read the contents of the file?

Upvotes: 2

Views: 4628

Answers (2)

Gajendran Mohan
Gajendran Mohan

Reputation: 70

you can use the following URL as a reference to read the file using js.

reference

Upvotes: -1

SLaks
SLaks

Reputation: 887285

You're looking for the HTML5 File API.

Upvotes: 2

Related Questions