This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes Uploaded image gets corrupt (Jakarta Commons Net) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Uploaded image gets corrupt (Jakarta Commons Net)" Watch "Uploaded image gets corrupt (Jakarta Commons Net)" New topic
Author

Uploaded image gets corrupt (Jakarta Commons Net)

M M Farhan
Greenhorn

Joined: Aug 09, 2006
Posts: 8
Hi,
I am using Jakarta Commons Net in my desktop application to upload images to the web server. It was working fine until the ftp was changed from ProFTPD 1.2.10 Server (ProFTPD) to Pure-FTPd.

Now, whenever i upload any image to the server it becomes corrupt.

I can see these are the changes in commands in CuteFTP:
---------------------------- ProFTPD --------------------------------------
STATUS:> Connecting FTP data socket 84.45.66.30:52309...
150 Opening ASCII mode data connection for file list
226 Transfer complete.
STATUS:> Directory listing completed.
COMMAND:> TYPE I
200 Type set to I
COMMAND:> TYPE A
200 Type set to A

----------------------------------------------------------------------------
------------------------------ Pure-FTPd -----------------------------------
STATUS:> Connecting FTP data socket 88.208.208.80:43332...
150 Accepted data connection
226-Options: -a -l
226 82 matches total
STATUS:> Directory listing completed.
COMMAND:> TYPE I
200 TYPE is now 8-bit binary
COMMAND:> TYPE A
200 TYPE is now ASCII
----------------------------------------------------------------------------

But i don't know how to overcome this problem or how to change to 8-bit mode.


Farhan
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8707
    
    6


Q: Why are my files corrupt after transfer?

A: The most common cause for this is when the file is transfered as ASCII but the contents of the file are not ASCII and the file should be transferred as BINARY. RFC 959 says the default transfer mode should be ASCII. FTPClient conforms to the standard. You must explicitly call setFileType(FTP.BINARY_FILE_TYPE); to request binary transfer mode after logging in to the FTP server.

Jakarta Commons Net Frequently Asked Questions


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Uploaded image gets corrupt (Jakarta Commons Net)
 
Similar Threads
FTPClient.retrieveFile() doesn't work properly.
Sensitive Information in logs/ console while FTP
File transfer using FTP
FTP issue (using org.apache.commons.net.ftp)
"200 PORT command successful. Consider using PASV." What does it mean?