• 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
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Upload Download File

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67590
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Upload form


Upload servlet



Download servlet
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
RAD is fine. You must be doing the stuff wrong.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic