我正在尝试将文件上传到CherryPy中实现的表单。实际上,从CherryPy网站上传的默认实现。本教程在这里,它可以从GUI工作:http://docs.cherrypy.org/stable/progguide/files/uploading.html
问题是当我从cURL尝试时:
curl -F "name=myFile" -F "filedata=@test2.xml" -X POST http://127.0.0.1:8080/upload
输出是:
<pre id="traceback">Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 656, in respond
response.body = self.handler()
File "/usr/local/lib/python2.7/dist-packages/cherrypy/lib/encoding.py", line 188, in __call__
self.body = self.oldhandler(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cpdispatch.py", line 40, in __call__
raise sys.exc_info()[1]
HTTPError: (404, 'Missing parameters: myFile')
</pre>
任何想法出了什么问题?
谢谢, 丹尼尔。
答案 0 :(得分:1)
这应该做:
curl -F "myFile=@test2.xml" -X POST http://127.0.0.1:8080/upload