大文件分块保存

This commit is contained in:
caoqianming 2021-06-16 11:40:06 +08:00
parent 88c4c01454
commit 818176f58a
1 changed files with 2 additions and 1 deletions

View File

@ -48,7 +48,8 @@ def upload(req):
filepath = os.path.join(user_upload_folder, file_name)
filepath = filepath.replace('\\','/')
with open( filepath, 'wb') as f:
f.write(req.FILES['mf'].read())
for i in req.FILES['mf'].chunks():
f.write(i)
return JsonResponse({"code":1,"filename":file_name,"filepath":filepath})
#查询
def selectDate(req):