Bonjour j'utilise l'API Jakarta Commons net pour faire du FTP (org.apache.commons.net.ftp).
Je pense pouvoir envoyer un fichier comme ça :
Mais j'aimerais envoyer tous les fichiers d'un dossier !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 FTPClient ftp = new FTPClient(); try { ftp.connect("monserveur"); ftp.login("login", "passwd"); ftp.changeWorkingDirectory("ftp/in/"); FileInputStream in = new FileInputStream(new File("C:\\tmp\\file.jpg")); ftp.storeFile("file.jpg", (InputStream)in); ftp.logout(); } catch (Exception e) { e.printStackTrace(); }
Comment faire ?
Partager