2024-06-16 12:45:47 发布
网友
有了Seafile,用户可以创建一个公共上传链接(例如https://cloud.seafile.com/u/d/98233edf89/),通过浏览器上传文件,而不需要认证。在
https://cloud.seafile.com/u/d/98233edf89/
Seafile webapi不支持任何不带身份验证令牌的上载。在
如何从命令行和curl或python脚本中使用这种链接?在
需要2小时才能找到curl的解决方案,需要两个步骤:
repo-id
curl 'https://cloud.seafile.com/ajax/u/d/98233edf89/upload/?r=f3e30b25-aad7-4e92-b6fd-4665760dd6f5' -H 'Accept: application/json' -H 'X-Requested-With: XMLHttpRequest'
答案是(json)在下一个上传帖子中使用的id链接,例如:
{"url": "https://cloud.seafile.com/seafhttp/upload-aj/c2b6d367-22e4-4819-a5fb-6a8f9d783680"}
curl 'https://cloud.seafile.com/seafhttp/upload-aj/c2b6d367-22e4-4819-a5fb-6a8f9d783680' -F file=@./tmp/index.html -F filename=index.html -F parent_dir="/my-repo-dir/"
答案又是json
[{"name": "index.html", "id": "0a0742facf24226a2901d258a1c95e369210bcf3", "size": 10521}]
完成;)
需要2小时才能找到curl的解决方案,需要两个步骤:
repo-id
作为查询参数对公共上行链路url发出get请求,如下所示:curl 'https://cloud.seafile.com/ajax/u/d/98233edf89/upload/?r=f3e30b25-aad7-4e92-b6fd-4665760dd6f5' -H 'Accept: application/json' -H 'X-Requested-With: XMLHttpRequest'
答案是(json)在下一个上传帖子中使用的id链接,例如:
{"url": "https://cloud.seafile.com/seafhttp/upload-aj/c2b6d367-22e4-4819-a5fb-6a8f9d783680"}
curl 'https://cloud.seafile.com/seafhttp/upload-aj/c2b6d367-22e4-4819-a5fb-6a8f9d783680' -F file=@./tmp/index.html -F filename=index.html -F parent_dir="/my-repo-dir/"
答案又是json
[{"name": "index.html", "id": "0a0742facf24226a2901d258a1c95e369210bcf3", "size": 10521}]
完成;)
相关问题 更多 >
编程相关推荐