This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python 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
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Using getInputStream and file upload  RSS feed

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am uploading a zip file to my server. I use getInputStream to read, while I write to an output stream (either FileOutputStream, or RandomAccessFile "rw"). This is done in a loop.
When I view my uploaded zip file on the server, it tells me there was "206 extra bytes at beginning or within zipfile." This makes my zipfile unable to get processed with another class's method. I get a ZipExeption. I tried setting my content type as both ("text/html") and not setting it at all (not sure why I did that). Any help would be greatly appreciated.
Thanks,
Tom
 
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to ask why you are trying to re-invent the wheel here. Orielly has an amazing upload package that handles all this in 1 or 2 lines of code!
You can find it here:
http://www.servlets.com/cos/index.html
 
Tom Triolo
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I like the wheel round like it is, so I will not try to re-invent it. I'll check that out. It would sure save a lot of frustration. Thanks for the reply.
Tom
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you should use setContentType("multipart/form-data")
 
Note to self: don't get into a fist fight with a cactus. Command this tiny ad to do it:
ScroogeXHTML 8.0 - RTF to HTML5 and XHTML converter
https://coderanch.com/t/704747/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!