On Tue, Jul 30, 2002 at 01:01:03AM -0700, Aseem Mohanty wrote:
Hi, I have a zip file that I create on the fly which is to be returned to the user. The process goes like this:
1. User clicks on a link. 2. External method creates a zip file and puts it in a temp folder( file system folder not Zope temp) 3. External method (same one) returns the zip file as part of response as type application/x-zip
The following is what I do in to get it done:(part 3 i.e.)
zip_size = stat(zip_file_name).st_size zip_file = open(zip_file_name) zip_data = zip_file.read() zip_file.close()
REQUEST.RESPONSE.setStatus('OK') REQUEST.RESPONSE.setHeader('Content-Type','application/x-zip') REQUEST.RESPONSE.setHeader('Content-Length',zip_size) REQUEST.RESPONSE.write(zip_data)
but when I try it out the following happens: - the zip file is created - zip_data has the data (of course) - i am prompted to download something of type application/x-unknown-content - if i save the file it has zero length
so what am I doing wrong or not doing here, that needs to be done to get this right?? TIA AM
--
I am doing something similar to this except I am setting up my zip file in an External Method, and then returning the read in zip file to a python script which looks something like this: data = context.externalMethodReturningZipFile() RESPONSE.setHeader('Content-Type', 'application/download') RESPONSE.setHeader('Content-Length', len(data)) RESPONSE.setHeader('Content-Disposition','attachment;filename=SomeFile.zip') return data HTH, Chris
================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- Chris Meyers Huttleston Data Design 7941 Tree Lane Suite 200 Madison WI 53717