【问题标题】:"Can't find file" error when calling UploadFiles调用 UploadFiles 时出现“找不到文件”错误
【发布时间】:2017-09-03 06:56:39
【问题描述】:

我遇到了 FluentFTP 库的 UploadFiles 方法的问题。这是我的代码:

var count = _client.UploadFiles(filesPaths, remotePath, true, true);
foreach(var path in filesPaths)
{
    AddLog(string.Format("Uploaded File: {0}", path));
}

在执行UploadFiles 之后,它会抛出一个异常,提示找不到文件。我发现当我使用remotePath = "/uploads" 时我有这个问题,但是当我将remotePath 设置为"/" 时,该方法上传文件没有问题。我检查了用户权限,他可以做任何事情。

我不知道可能是什么问题。我在 GitHub 上阅读了源代码,并没有发现任何奇怪的地方。

这是 FluentFTP 的错误吗?还是我错过了什么?

【问题讨论】:

标签: c# ftp upload fluentftp


【解决方案1】:

如果文件夹 /uploads 未创建,您将收到该异常。

选项 1:手动创建文件夹 uploads 并重试

选项 2:使用

DirectoryExists() - 检查服务器上是否存在目录。

CreateDirectory() - 在服务器上创建一个目录。如果父母 目录不存在,它们也被创建。

【讨论】:

    猜你喜欢
    • 2016-02-29
    • 2010-10-18
    • 1970-01-01
    • 1970-01-01
    • 2021-03-05
    • 1970-01-01
    • 2021-09-13
    • 2021-06-04
    • 2014-12-14
    相关资源
    最近更新 更多