I use this code in DJANGO framework to can some user download images. this code work fine and download image every time to press download some user.
but this code download absolute images I need to zip this images for any user download.
def download_image(request, id):
product_image=MyModel.objects.get(pk=id)
product_image_url = product_image.upload.url
wrapper = FileWrapper(open(settings.MEDIA_ROOT+ product_image_url[6:], 'rb'))
content_type = mimetypes.guess_type(product_image_url)[0]
response = HttpResponse(wrapper, content_type=content_type)
response['Content-Disposition'] = "attachment; filename=%s" % product_image_url
return response
is easy to change this code to download images in zip file ?