1 Star 0 Fork 344

freshways / fast-poster

forked from psoho / fast-poster 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
store.py 700 Bytes
一键复制 编辑 原始数据 按行查看 历史
thomas 提交于 2021-07-07 11:40 . v1.4.1 更换高性能框架tornado
import os
import C
def save_to_disc(filename, content_type, body):
"""
存储文件到磁盘
:param filename:
:param content_type:
:param body:
:return:
"""
name, ext = os.path.splitext(filename)
name = C.get_upload_dir() + '/' + C.code(16) + ext
with open(name, mode='bw') as f:
f.write(body)
return C.get_url_path(name)
def uploads(files):
items = []
for field_name, files in files.items():
for info in files:
filename, content_type = info["filename"], info["content_type"]
body = info["body"]
url = save_to_disc(filename, content_type, body)
items.append(url)
return items
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/freshways/fast-poster.git
git@gitee.com:freshways/fast-poster.git
freshways
fast-poster
fast-poster
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891