• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Uploaded image gets corrupt (Jakarta Commons Net)

 
M M Farhan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9318
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic