mis*_*tor 7 python tornado python-3.x
使用put请求时,如何在Tornado中访问上传的文件?
@require_basic_auth
class UploadFile(tornado.web.RequestHandler):
def put(self, params):
path = calculate_path(params)
# TODO: create an empty binary file at path and then copy
# the request input stream to it.
Run Code Online (Sandbox Code Playgroud)
@require_basic_auth
class UploadFile(tornado.web.RequestHandler):
def put(self, params):
path = calculate_path(params)
with open(path, 'wb') as out:
body = self.request.get_argument('data')
out.write(bytes(body, 'utf8'))
Run Code Online (Sandbox Code Playgroud)
......是我需要的.
在一些ActiveState页面上找到.
| 归档时间: |
|
| 查看次数: |
11211 次 |
| 最近记录: |