码迷,mamicode.com
首页 > 其他好文 > 详细

tornado存图片

时间:2019-11-12 12:46:57      阅读:103      评论:0      收藏:0      [点我收藏+]

标签:write   tor   self   tornado   async   one   file   pen   mod   

pic = self.request.files.get(‘pic‘, None)[0]
swf = pic.filename.split(‘.‘)[1]
print(swf)
filename = str(uuid.uuid4()) + ‘.‘ + swf
async with aiofiles.open(os.path.join(settings.MEDIA_ROOT, filename), mode=‘wb+‘) as f:
await f.write(pic.body)

tornado存图片

标签:write   tor   self   tornado   async   one   file   pen   mod   

原文地址:https://www.cnblogs.com/meili970202/p/11841014.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!