[Seaside] How to set the filename of a returned document?

Avi Bryant avi at beta4.com
Fri Oct 31 20:54:50 CET 2003


On Wednesday, October 29, 2003, at 08:22 AM, Ian Prince wrote:

> My application returns pdf files with:
>
> MyComponent>>renderContentOn: html
> 	html anchorWithDocument: contents
> 				mimeType: 'application/pdf'
> 				text: 'download'.
>
> The pdf  files returned have names based on the session ids, e.g. 
> @kMhhyhwLYiKxjcRl
>
> How can I go about  setting the filename of the returned document to 
> something else, such as "generated_document.pdf"?

You can do this with a header:

Content-Disposition: attachment; filename=generated_document.pdf

You would need to change WADocumentHandler>>response to optionally add 
this header, probably based on a 'filename' ivar.  You'd then want to 
add a variation of the #anchorWithDocument:... methods that set 
#filename:.

Send me a patch (or better, a .mcz) if you give it a shot, and I'll 
merge it in.  If you get lost, let me know.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 942 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/seaside/attachments/20031031/bdfce69e/attachment.bin


More information about the Seaside mailing list