J'ai changer la méthode avec le code suivant et ça marche :
public static void getDataFile( String server,
String username,
String password,
String folder,
String destinationFolder){
try
{
// Connect and logon to FTP Server
FTPClient ftp = new FTPClient();
ftp.connect( server );
ftp.login( username, password );
System.out.println("Connected to " +
server + "." );
System.out.print(ftp.getReplyString());
// List the files in the directory
System.out.println("le status est : "+ftp.getStatus());
ftp.changeWorkingDirectory( folder );
ftp.stor("test1.txt" );
}
catch( Exception e )
{
e.printStackTrace();
}
}
Mais si je veux uploader plusieurs fichiers dans le repertoire ça ne passe pas
Voici le code :
public static void getDataFile( String server,
String username,
String password,
String folder,
String destinationFolder){
try
{
// Connect and logon to FTP Server
FTPClient ftp = new FTPClient();
ftp.connect( server );
ftp.login( username, password );
System.out.println("Connected to " +
server + "." );
System.out.print(ftp.getReplyString());
// List the files in the directory
System.out.println("le status est : "+ftp.getStatus());
ftp.changeWorkingDirectory( folder );
File file = new File( folder + File.separator +"test.txt" );
File file1 = new File( folder + File.separator +"connexion.txt" );
InputStream fis1 = new FileInputStream(file);
InputStream fis2 = new FileInputStream(file1);
ftp.storeFile(file.getName(), fis);
ftp.storeFile(file1.getName(), fis1);
fis.close();
fis1.close();
}
catch( Exception e )
{
e.printStackTrace();
}
}