uploading Excel using POI
hello ,
i want to read excel file which user is going to upload from browser and copy data in database .
I go through various forums and as per information write some code .
using POI apis
I am new to POI apis
and my code is giving me FileNotFound Exception.
what may be wrong !!
regards ,
amol
[349 byte] By [
JAmola] at [2007-10-3 0:13:59]

// jsp code
<form name = "frm1" method = "post" enctype="multipart/form-data">
<input type = "file" name = "uploadme">
<INPUT TYPE="submit" >
</form>
// java code
POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(request.getParameter("uploadme")));
//#### above statement giving me an error
HSSFWorkbook wb = new HSSFWorkbook(fs);
HSSFSheet sheet = wb.getSheetAt(0);
HSSFRow row = sheet.getRow(0);
HSSFCell cell = row.getCell((short)0);
System.out.println("->" + cell.getStringCellValue());
regards,
amol
JAmola at 2007-7-14 17:04:10 >

A FileInputStream is used to input data from what your operating system calls a file. That's a file on your hard drive, in other words. You can't use it to input data from an HTTP file upload.
I recommend using Apache Commons FileUpload. Read its examples to find out how to access an uploaded file from an HTTP request. Like LRMK suggested.
Thanks u for your help,
I found the error by reading more on forum / tutorial,
if I use
enctype="multipart/form-data"
as property of form tag
then
request.getparameter() is giving null ,
proper way, is to use following line of code and proceed further
MultipartRequestParser mrp = new MultipartRequestParser(request, System.getProperty("user.dir") + System.getProperty("file.separator"));
InputStream xlFile = new FileInputStream(mrp.getFileName());
JAmola at 2007-7-14 17:04:10 >
