因为平时会想要把一些文件备份到天翼盘中(因为下载快),不过上传会很慢,就想要先用浏览器上传一下,拿到 URL 之后,在其它的电脑上传。
比如像这样的。 curl 'http://upload.cloud.189.cn/v5/V5WebUploadSmallFileAction' -H 'Referer: http://cloud.189.cn/main.action' -H 'Origin: http://cloud.189.cn' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36' -H 'Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryms5J6ZsvVe2gA2hV' --data-binary $'------WebKitFormBoundaryms5J6ZsvVe2gA2hV\r\nContent-Disposition: form-data; name="sessionKey"\r\n\r\n96317ab0-04a4-4682-8c4c-942f6656beb9\r\n------WebKitFormBoundaryms5J6ZsvVe2gA2hV\r\nContent-Disposition: form-data; name="parentId"\r\n\r\n-11\r\n------WebKitFormBoundaryms5J6ZsvVe2gA2hV\r\nContent-Disposition: form-data; name="albumId"\r\n\r\nundefined\r\n------WebKitFormBoundaryms5J6ZsvVe2gA2hV\r\nContent-Disposition: form-data; name="opertype"\r\n\r\n1\r\n------WebKitFormBoundaryms5J6ZsvVe2gA2hV\r\nContent-Disposition: form-data; name="fname"\r\n\r\n1.zip\r\n------WebKitFormBoundaryms5J6ZsvVe2gA2hV\r\nContent-Disposition: form-data; name="Filedata"; filename="1.zip"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n------WebKitFormBoundaryms5J6ZsvVe2gA2hV--\r\n' --compressed
然后我试着加上-F [email protected]
curl -F [email protected] 'http://upload.cloud.189.cn/v5/V5WebUploadSmallFileAction' -H 'Referer: http://cloud.189.cn/main.action' -H 'Origin: http://cloud.189.cn' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36' -H 'Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryms5J6ZsvVe2gA2hV' --data-binary $'------WebKitFormBoundaryms5J6ZsvVe2gA2hV\r\nContent-Disposition: form-data; name="sessionKey"\r\n\r\n96317ab0-04a4-4682-8c4c-942f6656beb9\r\n------WebKitFormBoundaryms5J6ZsvVe2gA2hV\r\nContent-Disposition: form-data; name="parentId"\r\n\r\n-11\r\n------WebKitFormBoundaryms5J6ZsvVe2gA2hV\r\nContent-Disposition: form-data; name="albumId"\r\n\r\nundefined\r\n------WebKitFormBoundaryms5J6ZsvVe2gA2hV\r\nContent-Disposition: form-data; name="opertype"\r\n\r\n1\r\n------WebKitFormBoundaryms5J6ZsvVe2gA2hV\r\nContent-Disposition: form-data; name="fname"\r\n\r\n1.zip\r\n------WebKitFormBoundaryms5J6ZsvVe2gA2hV\r\nContent-Disposition: form-data; name="Filedata"; filename="1.zip"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n------WebKitFormBoundaryms5J6ZsvVe2gA2hV--\r\n' --compressed
被提示
Warning: You can only select one HTTP request method! You asked for both POST Warning: (-d, --data) and multipart formpost (-F, --form).
请问应该用什么命令指定我要上传的文件呢,非常感谢。
1
defunct9 2017-10-03 16:42:25 +08:00 via iPhone
-T
|
2
lilydjwg 2017-10-04 13:43:40 +08:00
把 --data-binary 和 Content-Type 头去掉。如果你的表单里有你需要的数据,用 -F 指定一下。
|