• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Upload Download File

 
Ramy Raslan
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
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64618
86
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
 
Ben Souther
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 ]
 
Bauke Scholtz
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic