FTPClient 在上传到 android 上的 ftp 服务器时损坏图像?

FTPClient corrupts the images while uploading to ftp server on android?(FTPClient 在上传到 android 上的 ftp 服务器时损坏图像?)
本文介绍了FTPClient 在上传到 android 上的 ftp 服务器时损坏图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在尝试从 Android 手机 (HTC Desire HD) 将图像上传到 FTP 服务器(在我的本地 PC 上).图像将发送到 FTP 服务器,但它们已损坏.

I'm trying to upload images to a FTP server (on my local PC) from Android Phone (HTC Desire HD). Images are going to FTP server but they are corrupted.

并且方法(ftpClient.storeFile())抛出IOException(Bad File Number)

请帮帮我.

这是损坏的图片链接:

http://imageshack.us/photo/my-images/820/komikb.jpg/

这是代码:

FTPClient ftpClient = new FTPClient();
    try {
        ftpClient.connect("192.168.2.14");
        ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
        ftpClient.setFileTransferMode(FTP.BINARY_FILE_TYPE);
        ftpClient.setSoTimeout(10000);
        ftpClient.enterLocalPassiveMode();
        if(ftpClient.login("Administrator", "xxxx"))
        {
            File sFile=new File("mnt/sdcard/DCIM/komik.jpg");
            FileInputStream fs= new FileInputStream(sFile);
            String fileName = sFile.getName();
            Boolean result = ftpClient.storeFile("/ftpfile.atspace.co.uk/" + fileName, fs);
            String has = "";
        }
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

推荐答案

问题解决了.FTPClient 类有最后一个数据包数据丢失错误".但这已通过 3.0.1 23.05.2011 版本解决.

Problem is solved. FTPClient class has "last packet data loss bug". But this was solved with 3.0.1 23.05.2011 release.

你可以从关于bug的详细解释中看到:https://issues.apache.org/jira/browse/NET-409

You can see from detailed explanation about bug: https://issues.apache.org/jira/browse/NET-409

您可以下载固定版本https://repository.apache.org/content/repositories/snapshots/commons-net/commons-net/3.0.1-SNAPSHOT/

这篇关于FTPClient 在上传到 android 上的 ftp 服务器时损坏图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)