Win a copy of Serverless Applications with Node.js this week in the NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

Upload Download File  RSS feed

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i uploaded this .txt file

StartText{{{{{}}}}}EndText

but it into a DB2 Blop then download it in OutputStream

find this file

-----------------------------311112870412835 Content-Disposition: form-data; name="file"; filename="New Text Document.txt" Content-Type: text/plain StartText{{{{{}}}}}EndText -----------------------------311112870412835 Content-Disposition: form-data; name="SUBMIT" UPLOAD -----------------------------311112870412835--

as you can see any edit to the response is written to the OutputStream
which destroy all .doc and .jpeg file
can any one help
 
Marshal
Posts: 67255
170
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not without seeing your file handling code.

It looks as if the header values are being written to the file for some reason.
 
Ramy Raslan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Upload form


Upload servlet



Download servlet
 
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you parsing the multipart form yourself when there are already libraries out there for free that have already been written an battle tested?
 
Ramy Raslan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your reply can i ask you for some names of this libraries
 
Ramy Raslan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it works it just needed to be but into anther array of bytes
using the start position and end position




[ December 14, 2008: Message edited by: Ray Man ]
[ December 14, 2008: Message edited by: Ray Man ]
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Honestly, that's very horrible code. This smells like a ripoff from roseindia.net. Please ignore that site forever, it almost only shows bad code examples and introduces bad practies. It's maintained by amateurs with the only focus on advertisement incomes.

To handle file upload I highly recommend you the Apache Commons FileUpload API. Here it is: http://commons.apache.org/fileupload Especially read the 'User Guide' section how to use it. It's fairly easy. For trouble or just for tips/tricks consult the 'Frequently Asked Questions' section. It's simply great stuff; thoroughly tested in all known situations and highly reliable.
[ December 14, 2008: Message edited by: Bauke Scholtz ]
 
Ramy Raslan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes i know that but sadly i work on rational 6
which is the worst IDE you can see and it give me hard times
in my DB connection which is DB2 v8.1 express
bottom line i was in too much trouble with the db2 driver import to import any other jar

but thanks any way for the heads up i will sure take it in
consideration in the future
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RAD is fine. You must be doing the stuff wrong.
 
I will open the floodgates of his own worst nightmare! All in a tiny ad:
global solutions you can do at home or in your backyard
https://www.kickstarter.com/projects/paulwheaton/better-world-boo
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!