Bonsoir,

Je désire faire quelques tests en envoyant un simple fichier texte par ftp à ma machine virtuelle, voilà la méthode :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 
 
public static void sendFiles(String host, String username, String password, List<File> files, String destPathName) throws FtpException {
	FTPClient ftpClient = new FTPClient();
	try {
	    ftpClient.connect(host);
	    ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
	    if (!ftpClient.login(username, password))
		throw new FtpException("Error on authentication");
	    for (File file : files) {
		InputStream in = new FileInputStream(file);
		ftpClient.storeFile(file.getName(), in);
		in.close();
	    }
	} catch (Exception e) {
	    throw new FtpException(e);
	} finally {
	    try {
		ftpClient.logout();
		ftpClient.disconnect();
	    } catch (IOException e) {
		throw new FtpException(e);
	    }
	}

Mon souci c'est que mon upload se fait en 1 mn et sur le serveur, le fichier texte est vide.

Avez-vous une idée d'où pourrait venir mon problème ?

PS : Avec filezilla, ça marche très bien.

Merci de votre aide.