commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mohammed Abbas" <>
Subject Re: Multiple File Upload Problem
Date Sun, 16 May 2004 09:01:47 GMT
Thanks for the tip. I already posted a new request.

Thanks a Million,


---------- Original Message ----------------------------------
From: "Mohammed Abbas" <>
Reply-To: <>
Date:  Thu, 13 May 2004 19:27:19 +0400

>Hi All, 
>Im truly bugged for time and I would really need some help. 
>Part of my project requires me to use an FTP Client that can send sceheduled tasks to
a FTP Server residing on my network. All went well when I tried using this operation on one
file but now I having problems implemeting the same logic with multiple files (binary). Im
using a Timer to schedule the events to a Timer Task that lists all the files in the directory
and passes them FTP Client reference in the TimerTask. 
>When Im getting is that when the task is handling one file it returns a FileTransfer OK
(250) then a disconnection from the FTP Server and the program exits. Refering back to some
logs using a different FTP Software the PORT Command is called after successive calls to the
FTPServer and does so for until there are no files (I already tried simulating the scenario
using the SocketClient APIs but Im still getting the same result.) 
>Im initialising the FTPClient (connecting,validating connection then logging in + setting
binary filetype --- already active mode). Then I'm passing storing the file using the store(String,
FileInputStream) method. Im iterating the stor operation through a loop with no checks) 
>1) Is this is the way that its supposed to be done? If not how then. 
>2) Would it matter if I used the default Active mode instead of the Pasv mode. Which one
is better programmatically. 
>3) I cant find any samples for the multiple stor operation. Can someone please attach
a some code samples for the multiple send. 
>for (int i = 0; i < files.length; i++) {
>  synchronized (mScheduler) {
>     try {
>  	  String remoteFilePath = transfer.getRemoteDir() + "/" + files[i].getName();
>	  //mScheduler.mFtpClient.port(, 51); 
> stream = new[i].getPath());
>	  mScheduler.mFtpClient.storeFile(files[i].getName(), stream);
>	  stream.close();
>	}
>	catch (IOException ioe) {
>	  ioe.printStackTrace();
>	}
>	catch (Exception e) {
>	  e.printStackTrace();
>	}
>  }

Participate in 'Send and Win' SMS contest and win exciting prizes. 
Visit for more details. 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message