如何在安卓应用中上传图片到FTP服务器?

5

我能否在我的安卓应用程序中上传图片到FTP服务器?这些图片将已经通过相机拍摄好了。

在桌面应用程序中,我们可以使用FTP客户端将任何文件/图片上传到实时服务器。那么,在我们的安卓应用程序中,如何做类似的事情呢?

1个回答

5

使用这个方法对我来说很有效...

SimpleFTP ftp = new SimpleFTP();


                // Connect to an FTP server on port 21.
                ftp.connect("server address", 21, "username", "pwd");

                // Set binary mode.
                ftp.bin();

                // Change to a new working directory on the FTP server.


                ftp.cwd("path");

                // Upload some files.
                ftp.stor(new File("your-file-path"));              

                // Quit from the FTP server.
                ftp.disconnect();

获取更多信息和jar包请访问:http://www.jibble.org/simpleftp/


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接