Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error : upload excel file

 
Rajni Patel
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to upload excel file using struts1.

In my action class below code I have written,

Error is coming on line
fileSystem = new POIFSFileSystem(fs);

java.io.IOException: Invalid header signature; read 63361219987247567, expected
-2226271756974174256

I have find from some forum, because of Excel file format error is coming.

I have excel 2003 and just I create 2 rows and 2 column, simple excel file.

Please, could anybody can tell me , what's the problem?

thanks,
 
Radovan Vukovic
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This error coming probably from your file, could be that is corrupted?

Or (I did not work with version after 3.5) i know that this version did not support excel autofilter. Can be that this is in your file?
 
Rajni Patel
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just I did entry in 2 row & 2 column like name and no. and I close the file.
I have Excel 2003.

Please, Give me some suggestion.

Thanks
 
Radovan Vukovic
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why you are using POIFSFileSystem?
Only to create HSSFWorkbook?

If this is only reason then you can try and create HSSFWorkbook directly from InputStream

Check please
 
Rajni Patel
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reply.

My intense is to read excel file, and insert into database. I have change in my code. but still same error is coming.

Invalid header.



please guide me.

Thanks
 
Rajni Patel
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I print message of getContenttype() for excel file. What it should come?
getContentType() = application/octet-stream or
getContentType() = application/vnd.ms-excel
Is it necessary t any fix contenttype?

thanks,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic