如何在django forms.py中访问上传的文件列表

时间:2016-08-24 17:42:48

标签: django django-forms

我如何在Django中访问forms.py。

中的上传文件列表(多文件上传)

在视图中,我可以像这样访问文件列表:

request.FILES.getlist('files')

但在forms.py中我收到此错误:

Exception Value:    'UploadForm' object has no attribute 'request'

我在这个address中尝试了解决方案,但在使用此代码时出现错误:

def clean_files(self):
    data = self.request.FILES

错误

Exception Value:    

'NoneType' object has no attribute 'FILES'

0 个答案:

没有答案
相关问题