aspose file tools*
The moose likes Other Open Source Projects and the fly likes FTP in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "FTP in Java" Watch "FTP in Java" New topic
Author

FTP in Java

Bhupendra Gupta
Greenhorn

Joined: Oct 13, 2009
Posts: 1
Hi team,

I am new to java and an not sure whether this is the right place to ask question about FTP in java..

I have written a small code in java which FTPs to one of the remote server.

The code gives me the list of files that are present on that server but it does not uploads the file there.(code is running successfully though)

here is the code:

Could you please help me out with this
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42277
    
  64
Welcome to JavaRanch.

In the future, please UseCodeTags when posting code of any length. It's unnecessarily hard to read the code as it is, making it less likely that people will bother to do so. I've done this for you here.

For starters, you're ignoring the return value of "storeFile". That will tell you whether the file upload was successful or not. I'm not sure why you think that "client.changeToParentDirectory()" would tell you whether the upload was successful - it tells you whether changing the directory was successful, which is something entirely different.

Also note that you're using the complete client-side path as filename for the server - including the directories. You should truncate that to just the filename.

I'll move the post to the "Other Open Source Projects" forum, where the Apache libraries are discussed.


Ping & DNS - my free Android networking tools app
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9427
    
    2

Are you using any Apache related API's by the way?


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
 
 
subject: FTP in Java