• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

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.
 
I am going down to the lab. Do NOT let anyone in. Not even this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic