Android 使用FTP上传文件

Try using apache commons ftp

ftpClient.connect(InetAddress.getByName(server)); ftpClient.login(user, password); ftpClient.changeWorkingDirectory(serverRoad); ftpClient.setFileType(FTP.BINARY_FILE_TYPE); BufferedInputStream buffIn=null; buffIn=new BufferedInputStream(new FileInputStream(file)); ftpClient.enterLocalPassiveMode(); ftpClient.storeFile("test.txt", buffIn); buffIn.close(); ftpClient.logout(); ftpClient.disconnect(); 


必须使用被动模式

你可能感兴趣的:(apache,android,server,user,File)