• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

FTP in Java

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you using any Apache related API's by the way?
 
What I don't understand is how they changed the earth's orbit to fit the metric calendar. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic