Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

greater understanding of the interaction of java and ftp/ftps

 
peter m hayward
Ranch Hand
Posts: 65
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Firstly this post is about understanding and not simply asking for a solution
I have waded through vast documents only to find myself no better off mainly those provided by apache.commons so i appeal to anyone with a greater understanding please make it easier for other to follow what to do and more importantly why
I would like to start by ask about this line of code

The parameters in the bracket are there because? And what other parameters can be passed and where do you find this out ?
In my application the file that is uploaded carries the full url how can i remove the first part for example
C:\\jpegsToMatchBooks_30_Jan_12.zip  how can i end up with just
jpegsToMatchBooks_30_Jan_12.zip   as i think the C:\\ part even thou in this case it is just the name of the file is causing some issue on the server
here is my code


please note that this is not all my own code it has been adapted for my use, that said ther was little or no comments within the original code
 
Ron McLeod
Saloon Keeper
Posts: 1287
143
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
peter m hayward wrote:The parameters in the bracket are there because? And what other parameters can be passed and where do you find this out ?

You didn't say which library you were using, but most likely it is Apache Commons.  The documentation for that class can be found here: org.apache.commons.net.ftp.FTPSClient
 
Ron McLeod
Saloon Keeper
Posts: 1287
143
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
peter m hayward wrote:In my application the file that is uploaded carries the full url how can i remove the first part for example
C:\\jpegsToMatchBooks_30_Jan_12.zip  how can i end up with just
jpegsToMatchBooks_30_Jan_12.zip   as i think the C:\\ part even thou in this case it is just the name of the file is causing some issue on the server

One way would be to create a new File object using the file path string that you have, and use the getName() method to get the last segment in the file path.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!