问题总结
1.django用post传文件,如何接收和下载?
data= request.FILES.get("file")#接收到的数据类型是<class "django.core.files.uploadedfile.InMemoryUploadedFile">
# print(data,type(data)) #<class "django.core.files.uploadedfile.InMemoryUploadedFile">
with open(r"C:Users33101Desktop12新建1111.txt","wb") as p:#这样可以写进文件,不能直接p.write(chunks())
for chunk in data.chunks():
p.write(chunk)

![问题总结[Python常见问题]](https://www.zixueka.com/wp-content/uploads/2023/10/1696830770-2a2f29f4305d8c0.jpg)
