This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Commons FTPClient is corrupting my images  RSS feed

 
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone know why or able to provide a correct example of the storeFileStream method for storing images? All uploaded images are a bit larger than the original and are (obviously) corrupt. I have done it both with and without the copyStream Util method with equal results.

 
Sheriff
Posts: 23696
50
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My initial reaction, just from reading the title, was that you forgot to do this:

But it looks like you didn't forget that. My next reaction was that it was your copyStream utility that was broken, but then you said you tested it without that utility too.

You do need a call to client.completePendingCommand() after you finish writing to that output stream, and I don't see that in your code, but I wouldn't expect that to make the file on the server get larger.

If I were you I would look at the two files with a hex editor and see what's different between the two. If you find extra line-ending characters then you didn't set the binary file type.
 
Kerry Wilson
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, I removed the remote passive command and added the complete pending and it works.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!