使用终端命令将文件从本地主机卷曲到远程主机

时间:2019-10-12 23:52:14

标签: curl file-upload terminal

我正在尝试使用来自终端的curl命令将一些文件上传到我的远程主机,但是我遇到了问题。该命令似乎可以正常运行(我的意思是控制台上没有错误),但是该文件未显示在我的远程服务器上。我哪里错了?

我使用的命令:

"curl -H "Content-Type:multipart/form-data" -i -X POST -F "imageFile=@/image.png" http://www.myserver.com/upload -v"

命令行响应:

Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying 'ip'
* TCP_NODELAY set
* Connected to www.myserver.com (ip) port 80 (#0)
> POST /upload HTTP/1.1
> Host: host
> User-Agent: curl/7.64.1
> Accept: */*
> Content-Length: 50793
> Content-Type: multipart/form-data; boundary=------------------------90dda85d9d37ee68
> Expect: 100-continue
> 
< HTTP/1.1 301 Moved Permanently
HTTP/1.1 301 Moved Permanently
< Date: Sat, 12 Oct 2019 23:44:17 GMT
Date: Sat, 12 Oct 2019 23:44:17 GMT
< Server: Apache
Server: Apache
< Location: http://www.myserver.com/upload/
Location: http://www.myserver.com/upload/
< Content-Length: 249
Content-Length: 249
< Connection: close
Connection: close
< Content-Type: text/html; charset=iso-8859-1
Content-Type: text/html; charset=iso-8859-1

< 
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://www.myserver.com/upload/">here</a>.</p>
</body></html>
* Closing connection 0

0 个答案:

没有答案