class BoardFiles(models.Model):
index = models.CharField(max_length=50, blank=True)
file = models.FileField(upload_to='static-assets/')
<form method="post" action="/board/update/" enctype="multipart/form-data">
<input type="file" name="file" id="id_file" multiple/>
</form>
@csrf_exempt
def board_update(request):
for file in request.FILES.getlist('file'):
fl = BoardFiles (index=request.POST['id'],
file=file)
fl.save()
但是,当我上传文件时,BoardFiles表上没有数据。 有什么问题?