本地源文件:/tmp/back/wp.bak.sql
Dst 文件:/
我的访问 token 是 xxxxxx。
我想把本地电脑的/tmp/back/wp.bak.sql上传到dropbox根目录下,名字不变。
curl 命令1:
curl -X POST https://content.dropboxapi.com/2/files/upload \
--header 'Authorization: Bearer xxxxxx' \
--header 'Content-Type: application/octet-stream' \
--header 'Dropbox-API-Arg: {"path":"/"}' \
--data-binary @'/tmp/back/wp.bak.sql'
输出信息。
{"error_summary": "path/malformed_path/...", "error": {".tag": "path", "reason": {".tag": "malformed_path"}, "upload_session_id": ""}}
curl 命令2:
cd /tmp/back
curl -X POST https://content.dropboxapi.com/2/files/upload \
--header 'Authorization: Bearer xxxxxx' \
--header 'Content-Type: application/octet-stream' \
--header 'Dropbox-API-Arg: {"path":"/"}' \
--data-binary @'wp.bak.sql'
相同的错误信息。 如何修复我的 curl 命令的 malformed_path?
最佳答案
在 path
字段中输入文件的完整路径:
--header 'Dropbox-API-Arg: {"path":"/wp.bak.sql"}'
所以:
curl "https://content.dropboxapi.com/2/files/upload" \
-H 'Authorization: Bearer xxxxxx' \
-H 'Content-Type: application/octet-stream' \
-H 'Dropbox-API-Arg: {"path":"/wp.bak.sql"}' \
--data-binary @'wp.bak.sql'
关于bash - 用于将文件上传到我的保管箱的格式错误的路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44819200/