• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Commons FTPClient is corrupting my images

 
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, I removed the remote passive command and added the complete pending and it works.
reply
    Bookmark Topic Watch Topic
  • New Topic