iceEditor 粘贴

This commit is contained in:
HuYang 2020-12-15 10:19:41 +08:00
commit 3915de13c1
2 changed files with 18 additions and 18 deletions

View File

@ -33,7 +33,7 @@
## 打赏
<p align="center">给作者打赏一罐红牛,祝他天天能迭代,日日可更新</p>
<p align="center">给作者打赏一罐红牛,祝他天天能迭代,日日可更新<a href="http://mrdoc.zmister.com/project-7/doc-1366/">打赏赞助鸣谢榜</a></p>
<p align="center">
<a href="http://mrdoc.zmister.com/project-7/doc-434/">微信</a>|

View File

@ -69,23 +69,23 @@ def ice_save_file(file_obj,user):
with open(path_file, 'wb') as f:
for chunk in file_obj.chunks():
f.write(chunk) # 保存文件
if file_suffix.lower() in is_images:
Image.objects.create(
user=user,
file_path=file_url,
file_name=file_name,
remark="iceEditor上传"
)
else :
#文件上传暂时不屏蔽如果需要正常使用此功能是需要在iceeditor中修改的mrdoc使用的是自定义脚本上传
Attachment.objects.create(
user=user,
file_path=file_url,
file_name=file_name,
file_size=str(round(len(chunk)/1024,2))+"KB"
)
return {"error":0, "name": str(file_obj),'url':file_url}
if file_suffix.lower() in is_images:
Image.objects.create(
user=user,
file_path=file_url,
file_name=file_name,
remark="iceEditor上传"
)
else :
#文件上传暂时不屏蔽如果需要正常使用此功能是需要在iceeditor中修改的mrdoc使用的是自定义脚本上传
Attachment.objects.create(
user=user,
file_path=file_url,
file_name=file_name,
file_size=str(round(len(chunk)/1024,2))+"KB"
)
return {"error":0, "name": str(file_obj),'url':file_url}
return {"error": "文件存储异常"}