• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Apache Commons FileUpload FileItem bug??

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 (http://jakarta.apache.org/commons/fileupload/using.html).

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,

Beto.
 
Alberto de Paola
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some specs I forgot:

some .pdf file of 200-400 KB weren't uploaded, while a real big 1.6 MB .pdf got right trough.
.txt files were 1-55 KB, and the mp3 was 2 MB.

I'm using the default configurations for DiskFileItemFactory
and FileItem.isInMemory() is TRUE for everyone.

hope it helps you help me

Beto.
 
Alberto de Paola
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some specs I forgot:

some .pdf file of 200-400 KB weren't uploaded, while a real big 1.6 MB .pdf got right trough.
.txt files were 1-55 KB, and the mp3 was 2 MB.

I'm using the default configurations for DiskFileItemFactory
and FileItem.isInMemory() is TRUE for everyone.

hope it helps you help me

Beto.
reply
    Bookmark Topic Watch Topic
  • New Topic