wood burning stoves 2.0*
The moose likes Sockets and Internet Protocols and the fly likes Problems with ftp, commons library Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Problems with ftp, commons library" Watch "Problems with ftp, commons library" New topic
Author

Problems with ftp, commons library

mandlar suurla
Ranch Hand

Joined: Jun 11, 2008
Posts: 67

I am really stuck now by using ftp. I am using commons library and some other jars which are needed for commons.

Currently I made, also took some code from tutorial site the ftpLayer so it would be easier to connect and some other things.
So i follow this schema: connect, login - when start upload download set the passivemode on, binary for transfering, get the stream(Input or Output), close the I/o and then ftp disconnect.

Problem: This schema works for when i am working with one, but i wanted to upload and download many files. But when used this schema it sometimes work and sometimes not. But there's really big flaw in my transfer process. When use for many times transfer scheama is

nextfile: <- this label like you have seen it in some BASIC code
loop starts
connectlogin
passivmode on
binary on

start upload

i/o close
ftp disconnect
GOTO nextfile
//////////////////////////////////////
but when i used, got error, this solution should be right
nextfile: <- this label like you have seen it in some BASIC code
connectlogin
passivmode on
binary on
loop starts
start upload
i/o close

GOTO nextfile
ftp disconnect
T.A. Nguyen
Ranch Hand

Joined: Sep 02, 2008
Posts: 36

You should change to:

connect server
login user/password
passivemode on
binary on
nextfile: <- this label like you have seen it in some BASIC code
put file
GOTO nextfile
disconnect

alternatively, if the FTPClient package support, you should use the mput command instead.

connect server
login user/password
passivemode on
binary on
mput file1 file2 file3 file4 file5
disconnect


T.A. Nguyen
http://ta.cnci.org
http://www.linkedin.com/in/nguyenta
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems with ftp, commons library
 
Similar Threads
FTPClient : is not working
FTP: Transfer is working but all TXT files have no content
Make upload and download a file facility in a project.
Regarding FTP froma remote server
How to get current time from FTP server