Michel Thadeu wrote:
> Hi guys!
>
> I want to change the name of a response, i working on a way to a
> servlet acts as a file to download, I call the servlet with the proper
> request values, then I change the content-type to octet-stream and then
> print the proper data...
>
> My problem is that I know what type of file I will send (if it will be
> a .txt, .pdf, .tgz or anything else) but I don´t know the way call the
> response with the proper name, if there is that way.
>
done recently, you are a lucky guy :) here's there the code snippet
taken from my download.py servlet:
response.setHeader('Content-Type', str(mimeType))
response.setHeader('Content-Length', '%d' % len(data))
response.setHeader('Content-Disposition', 'attachment; filename=%s' %
str(name))
self.write(data)
cheers,
deelan
|