【问题标题】:Upload File Commons FTPS Android Studio上传文件 Commons FTPS Android Studio
【发布时间】:2018-04-30 23:32:49
【问题描述】:

我在通过 SFTP 上传文件时遇到问题,我查找了信息问题是,当我想将图像上传到 SFTP 时,我上传了 0 KB 的图像名称我想知道我上传的 FTP 会发生什么它和我添加了相应的证书。使用 WinSCP,我没有任何问题,我将不胜感激。

FTPSClient ftpClient = new FTPSClient(false);
        try {
          Log.i("chama",NameOfFile);

            ftpClient.connect(url);

            ftpClient.login(us, pass);
            ftpClient.enterLocalPassiveMode();
            ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
            ftpClient.enterLocalPassiveMode();
            ftpClient.execPBSZ(0);
            ftpClient.execPROT("P");
         // Run the passive mode command now  instead of after loggin in.
            File localFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + NameOfFolder + "/" + NameOfFile);
            InputStream inputStream = new FileInputStream(localFile);

            ftpClient.storeFile(NameOfFile , inputStream);

            ftpClient.disconnect();

        } catch (IOException e) {
            e.printStackTrace();
            return false;
        } catch (NetworkOnMainThreadException ex) {
            return false;
        }
        return false;
    }

【问题讨论】:

  • FTPS 不是 SFTP + Post WinSCP 日志文件。 + 你可以访问服务器端日志吗?
  • 如果您可以使用另一个 ftps 应用程序访问 ftps 服务器,它会正常执行所有操作,并且从 android 只需上传文件名
  • 发布日志显示。
  • 解决方案所有代码都很好,只是缺少 ftp 的配置,在配置文件 vsftpd.conf 中添加这两行 require_ssl_reuse = NO ssl_ciphers = HIGH

标签: android-studio ftp apache-commons ftps


【解决方案1】:

解决方案 所有代码都很好,只是缺少 ftp 的配置,在配置文件 vsftpd.conf 中添加这两行 require_ssl_reuse = 否 ssl_ciphers = 高

【讨论】:

  • 这是一种解决方法,而不是解决方案。 SSL 会话重用是一项有用的功能,您不应禁用它。请参阅问题,我已在上面链接。
猜你喜欢
  • 1970-01-01
  • 2015-07-09
  • 1970-01-01
  • 1970-01-01
  • 2019-12-06
  • 1970-01-01
  • 2010-11-11
  • 2011-01-10
  • 1970-01-01
相关资源
最近更新 更多