David Siedband wrote:
In one of the web apps I'm working on, users upload files into a LocalFS directory. The python upload script renames the files so that the files name is unique, and based on the corresponding unique ID of it's metadata in my database. Though now when people download the files they have names like 14201.pdf instead of the original filename. Is there a way I can rename the file back to it's original name (stored in the db) upon download?
You need to set an additional header, something like the following template should work as "download-wrapper", maybe you can even call the RESPONSE.setHeader() from a PythonScript as precondition when accessing a file <dtml-call "RESPONSE.setHeader('Content-Disposition','Attachment; Filename=%s' % yourFilenameFromDB)"><dtml-return "yourFileObject()"> Cheers, Maik