downloading archives response corrupts files
        Posted  
        
            by panchicore
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by panchicore
        
        
        
        Published on 2010-04-03T00:40:49Z
        Indexed on 
            2010/04/03
            0:43 UTC
        
        
        Read the original article
        Hit count: 370
        
        wrapper = FileWrapper(file("C:/pics.zip"))
        content_type = mimetypes.guess_type(result.files)[0]
        response = HttpResponse(wrapper, content_type=content_type)
        response['Content-Length'] = os.path.getsize("C:/pics.zip")
        response['Content-Disposition'] = "attachment; filename=pics.zip"
        return response
pics.zip is a valid file with 3 pictures inside.
server response the download, but when I am going to open the zip, winrar says This archive is either in unknown format or damaged!
If I change the file path and the file name to a valid image C:/pic.jpg is downloaded damaged too.
What Im missing in this download view?
© Stack Overflow or respective owner