python - 如何在 django 临时目录位置上传大文件?
问题描述
这是我试图做的:
def handle_uploaded_file(f):
with open('/home/arvind/Desktop/newupload/documents/'+f.name, 'wb') as destination:
filepath = destination.name
for chunk in f.chunks():
#time.sleep(1)
destination.write(chunk)
def fileupload(request):
if request.method == 'POST':
files = request.FILES.getlist('uploadfile')
for f in files:
handle_uploaded_file(f)
return HttpResponse('add')
return HttpResponse("done")
解决方案
推荐阅读
- excel - 根据其位置(范围)在excel中选择一个按钮
- angular - 角材料分页/打字稿
- ms-access - 字段值等于另一个表中的最大值
- android - Android文件意外结束
- python - 在 pandas 数据框中查找至少相隔 30 分钟但不是定期 30 分钟间隔的时间戳
- sql - 如何使用 oracle 数值函数对列中的值进行分类
- windows - 带有 EVR 输出的 DirectShow 旋转过滤器
- c# - 如何在实体框架中的多对多关系中按id查询?
- c# - 在 C# 中非常快速地处理串行端口字符串数据
- authorize.net - 授权 .NET 客户付款配置文件