Warrior
Warrior

Reputation: 3304

How to get browsed filepath in jsp..............?

Hi i am selecting a txt/XLS file through and need to pass the same to a function to read the content and its not happening for me ....... how can i pass file path to file content reader Function

Code am using to Browse file:

    <input type="file" name="uploadfile" id="uploadfile" size="40" value=""/>

BufferedReader bF =  new BufferedReader(new FileReader(*** File Path here ***));

BufferedReader bF =  new BufferedReader(new FileReader("cia.txt"));

I want to get dynamic selected files into file reader......

Thank you..

Upvotes: 1

Views: 3275

Answers (2)

Gnanz
Gnanz

Reputation: 1873

If variable "uploadfile" is an File type variable(need to be) then try uploadfile.getAbsolutePath()

Btw what server side technology you are using(framework)

Upvotes: 1

WhiteFang34
WhiteFang34

Reputation: 72079

You need to use something like Apache Commons FileUpload to process uploaded files.

Upvotes: 0

Related Questions