Bonjour,
Comment je peux connecter à un serveur web FTP?
j'ai utiliser ce Code mais il m'affiche plusieurs erreurs...

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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
public class TestFTPActivity extends Activity {
	public FTPClient mFTPClient = null;
	String TAG="Info";
	String host="ftp://67.220.217.235";
	int port=21;
	String username="localisation-mobile_zxq";
	String password="******";
 
	public void onaCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		try { 
			ftpConnect(host, username, password, port); 
		} 
		catch (Exception e) { 
			Log.println(1, "FTP", e.getMessage()); 
			e.printStackTrace(); 
		} 
	} 
 
 
	public boolean ftpConnect(String host, String username,
			String password, int port)
	{
		try {
			mFTPClient = new FTPClient();
			// connecting to the host
			mFTPClient.connect(host, port);
 
			// now check the reply code, if positive mean connection success
			if (FTPReply.isPositiveCompletion(mFTPClient.getReplyCode())) {
				// login using username & password
				boolean status = mFTPClient.login(username, password);
 
				/* Set File Transfer Mode
				 *
				 * To avoid corruption issue you must specified a correct
				 * transfer mode, such as ASCII_FILE_TYPE, BINARY_FILE_TYPE,
				 * EBCDIC_FILE_TYPE .etc. Here, I use BINARY_FILE_TYPE
				 * for transferring text, image, and compressed files.
				 */
				mFTPClient.setFileType(FTP.BINARY_FILE_TYPE);
				mFTPClient.enterLocalPassiveMode();
 
				return status;
			}
		} catch(Exception e) {
			Log.d(TAG, "Error: could not connect to host " + host );
		}
 
		return false;
	}
}
Voila les erreurs de logcat:
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
05-15 09:53:02.891: E/dalvikvm(300): Could not find class 'org.apache.commons.net.ftp.FTPClient', referenced from method com.test.ftp.android.TestFTPActivity.ftpConnect
05-15 09:53:03.281: E/AndroidRuntime(300): FATAL EXCEPTION: main
05-15 09:53:03.281: E/AndroidRuntime(300): java.lang.NoClassDefFoundError: org.apache.commons.net.ftp.FTPClient
05-15 09:53:03.281: E/AndroidRuntime(300): 	at com.test.ftp.android.TestFTPActivity.ftpConnect(TestFTPActivity.java:36)
05-15 09:53:03.281: E/AndroidRuntime(300): 	at com.test.ftp.android.TestFTPActivity.onCreate(TestFTPActivity.java:23)
05-15 09:53:03.281: E/AndroidRuntime(300): 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-15 09:53:03.281: E/AndroidRuntime(300): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-15 09:53:03.281: E/AndroidRuntime(300): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-15 09:53:03.281: E/AndroidRuntime(300): 	at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-15 09:53:03.281: E/AndroidRuntime(300): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-15 09:53:03.281: E/AndroidRuntime(300): 	at android.os.Handler.dispatchMessage(Handler.java:99)
05-15 09:53:03.281: E/AndroidRuntime(300): 	at android.os.Looper.loop(Looper.java:123)
05-15 09:53:03.281: E/AndroidRuntime(300): 	at android.app.ActivityThread.main(ActivityThread.java:4627)
05-15 09:53:03.281: E/AndroidRuntime(300): 	at java.lang.reflect.Method.invokeNative(Native Method)
05-15 09:53:03.281: E/AndroidRuntime(300): 	at java.lang.reflect.Method.invoke(Method.java:521)
05-15 09:53:03.281: E/AndroidRuntime(300): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-15 09:53:03.281: E/AndroidRuntime(300): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-15 09:53:03.281: E/AndroidRuntime(300): 	at dalvik.system.NativeStart.main(Native Method)
Je pense j'ai mal rempli les paramètres de connexion!!

Merci d'avance pour votre aide