Jerome Alet wrote:
On Fri, 1 Mar 2002, Yves Bastide wrote:
<a href="http://my.host/retrieve?id=42">results.xls</a> where ``retrieve´´ is the script.
I would like instead to be able to present an address like: <a href="http://my.host/retrieve/42/results.xls">results.xls</a>
This is the only way I know of to pass the filename to the client (though I'd be happy to be corrected).
Make retrieve set the correct content-type and content-disposition in the response's headers, and you'll be able to choose the name of the file.
an example with application/pdf as the content-type :
<UNTESTED> ... filename = "myfile.pdf" REQUEST.RESPONSE.setHeader('Content-Type', 'application/pdf') REQUEST.RESPONSE.setHeader('Content-Disposition', 'attachment; filename=%s' % filename) return filedata() ... <UNTESTED>
filedata() shoudl retunr the actual file contents.
hth.
Yes, this works enough (wget doesn't grok it, but Mozilla and IE use the filename in their Save As dialog). Will do! Thanks Jérôme, Yves
Jerome Alet - alet@unice.fr - http://cortex.unice.fr/~jerome Fac de Medecine de Nice http://wwwmed.unice.fr Tel: (+33) 4 93 37 76 30 Fax: (+33) 4 93 53 15 15 28 Avenue de Valombrose - 06107 NICE Cedex 2 - FRANCE