سؤال

I am trying to upload a file to a form implemented in CherryPy. Actually, the default implementation of upload from the CherryPy website. The tutorial is here and it works from a GUI: http://docs.cherrypy.org/stable/progguide/files/uploading.html

The problem is when I try from cURL:

 curl -F "name=myFile" -F "filedata=@test2.xml" -X POST http://127.0.0.1:8080/upload

And the output is:

<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>

Any ideas what is going wrong?

Thanks, Daniel.

هل كانت مفيدة؟

المحلول

This should do:

 curl -F "myFile=@test2.xml" -X POST http://127.0.0.1:8080/upload
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top