I'm using python 2.4, Django 1.2.1. If this is resolved in a later version, I can upgrade but this system has been running smoothly in production for a year and management resists those types of upgrades unless I can clearly identify that it has been solved in 1.3
I want to upload a zipfile (sent from Adobe's flex/flash) without writing a tmp file. I can do this if the file was not compressed. The code I use to create the zipfile is...
zipper = zipfile.ZipFile(path, mode='w') for assessment in assessments: docid = assessment['FAC_DOC_ID'] xmlfilename = docid+".xml" xmltext = xmlbuilder.getXML(assessment) zipper.writestr(xmlfilename, xmltext) zipper.close()and I can read this in views.py with...
def upload(request, *args, **kwargs): filedata = request.FILES['Filedata'] buffer = filedata.read().... zipper = ZipString(buffer) for name in zipper.namelist(): content = zipper.read(name) x = process_xml_file(name, content)_____________________________________
but when I try to upload a zipfile from a vendor of the same data that is compressed I get a badzipfile error.
zipfile.BadZipfile: File is not a zip file
I'm wondering if the request adds/removes some header/trailer that messes up a zipfile if that file is binary (compressed) rather than ASCII (uncompressed).
I've been on this for several days and am really stuck. I tried to send a similar request via email but had trouble getting past company security. If this has been asked an answered I sincerely apologize.
Fred.