Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Apache Commons FileUpload FileItem bug??

Alberto de Paola
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody:

I'm using commons-fileupload-1.2 and it's working just fine to upload ANY type of file to the server file system.

For that, I use the same example provided by them in the User Guide (

I need to put the file inside a database, hence I use the FileItem.get() or FileItem.getOutputStream() method to retrieve the binary content and put it in a blob field.

The problem is that with some files, both get() and getOutputStream(), the bytes I get represent blank objects of the file type I'm uploading.

There is no error, just wrong bytes.

It worked with .txt, .mp3 and some .pdf.
Till now, no Microsoft Office document has been uploaded.

I thought in some kind of trouble with the program version in witch the file was produced, what should explain why some .pdf are being correctly 'geted' and some not, but didn't tested it yet, because it didn't make sens to me.

I post here because the problem is not the DB but the get() or getOutputStream() methods, at least from my point of view.

I'm really with this...

Thanks in advance,

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic