如何使用curl将文件上传到共享b2drop.eudat(owncloud)存储库?

时间:2017-06-14 16:15:57

标签: curl console wget owncloud

以下链接:https://b2drop.eudat.eu/s/DfQlm5J42nEGnH7包含文件和文件夹(可公开访问)。请注意,不需要用户名和密码。

我可以通过以下方式下载zip文件:

wget https://b2drop.eudat.eu/s/DfQlm5J42nEGnH7/download

这将生成一个下载文件。我可以通过以下方式解压缩:unzip download

在网站的GUI上,当我点击加号而不是upload签名时,会打开一个部分,我可以选择要下载的文件。我想通过控制台完成所有这些操作。

enter image description here enter image description here

[问]从我的GUI我也可以上传文件。是否可以使用curlwget

使用控制台上传文件

以下命令没有帮助。

 curl --upload-file run.sh https://b2drop.eudat.eu/s/DfQlm5J42nEGnH7/

我也尝试过以下链接:https://github.com/owncloud/pyocclient但它也没有帮助。

oc = owncloud.Client('https://b2drop.eudat.eu/')
oc.login('username@domain.edu', password ); 
oc.put_file( "https:/b2drop.eudat.eu/s/DfQlm5J42nEGnH7", "path/to/upload/run.sh")
oc.put_file( "/s/DfQlm5J42nEGnH7", "path/to/upload/run.sh")
oc.put_file( "/DfQlm5J42nEGnH7", "path/to/upload/run.sh")

感谢您宝贵的时间和帮助。

1 个答案:

答案 0 :(得分:1)

从网络日志分析来看,这是对PUT https://b2drop.eudat.eu/public.php/webdav/<filename> text/plainDfQlm5J42nEGnH7内容类型的请求,其基本身份验证没有密码,用户名为run.sh。< / p>

以下内容将上传本地文件curl -X PUT -H 'Content-Type: text/plain' \ -H 'Authorization: Basic RGZRbG01SjQybkVHbkg3Og==' \ --data-binary '@run.sh' \ https://b2drop.eudat.eu/public.php/webdav/run.sh

DfQlm5J42nEGnH7:

请注意,基本身份验证base64编码的字符串提供public class RoastedCoffeeProduct { [Key] public Guid ProductId { get; set; } public string Name { get; set; } public string Brand { get; set; } public string StoreName { get; set; } public Location StoreLocation { get; set; } public decimal CurrentPrice { get; set; } public int StoreStock { get; set; } } public class Location { public Guid LocationId { get; set; } public string Country { get; set; } public string Region { get; set; } } 已解码(用户名:密码)

原始网络日志:

enter image description here