• Post Reply Bookmark Topic Watch Topic
  • New Topic

Commons FTPClient is corrupting my images  RSS feed

 
Kerry Wilson
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.

 
Paul Clapham
Sheriff
Posts: 22691
43
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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!