Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

FTP in Java

 
Bhupendra Gupta
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Joe Harry
Ranch Hand
Posts: 10079
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using any Apache related API's by the way?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic