我想在视图中解压缩文件zip并将所有文件保存在zip文件上传中

时间:2019-05-08 00:13:07

标签: python django

我有一个视图如何上传png pdf docs之类的文件,我想提取一个zip文件并上传我所有的文件,如何在zip文件中找到COM = zipfile  如果formData [“ category”] == Advertisement.MEDIA [0]:                 如果file_type =='COM':

                with ZipFile(files_uploaded['file'], 'r') as z:
                    for f in z.namelist():
                        names = z.namelist()
                    for i in range(len(names)):
                        bs = False
            else:
                ad.file = img_upload_to_file(
                    company, files_uploaded['file'], formData["file_generated"], file_type, log)
        ad.duration = get_duration_according_by_file_type(
            formData, ad.file)
        ad.save()

0 个答案:

没有答案