This is a followup from the Webware-discuss list (see `Has anyone tried to stream a reportlab`__) .. __: http://www.geocrawler.com/lists/3/SourceForge/3854/0/7046376/ The Content Disposition Header is defined in `RFC 2183`_. Its purpose (among others) is to give a hint about the name of the following content. This is quite useful, when one tries to pipe a file to the browser. Without this header, the browser will show the scriptname, instead of the filename, when trying to use the Save as function. .. _RFC 2183: http://www.faqs.org/rfcs/rfc2183.html The following code should run right away as a servlet. It shows the content of some directory and lets you download its files. It is tested with Webware (10 day old CVS), OneShot.cgi Adapter and the following browsers. The following list gives you an idea, what browsers will show the right filename (or not): * Opera on Linux (works) * Konqueror (doesn't work) * Mozilla 0.96 on Linux (doesn't work, though it should according to documentation) IE5 should work. --- :: from WebKit.Page import Page import os, mimetypes FILEDIR = "/path/to/directory" class Main(Page): def title(self): return 'Webware Download Test Page' def writeBody(self): response = self.response() request = self.request() adapterName = request.adapterName() if request.hasField('file'): filename = '%s/%s' % (FILEDIR,request.field('file')) (mtype,enctype) = mimetypes.guess_type(filename) fd = open(filename) response.setHeader('Content-Type',mtype) response.setHeader('Content-Disposition','attachment; filename="%s"' % request.field('file')) response.flush() chunksize = response.streamOut().bufferSize() outchunk = fd.read(chunksize) while outchunk: self.write(outchunk) outchunk = fd.read(chunksize) else: files = os.listdir(FILEDIR) self.writeln('