[Catalyst] "Save as..."

Ash Berlin ash_cpan at firemirror.com
Fri Nov 9 14:29:11 GMT 2007

Octavian Rasnita wrote:
> Hi,
> I try to print a file to the browser using:
> $c->res->content_type('Application/Octet-Stream');
> $c->res->header("Content-Disposition" => 
> "attachment;filename=\"$file\"");
> # $c->res->header('Content-Length' => length($content));
> $c->res->body($content);
> If I try to save the file pressing enter on the link to download the 
> file, the window that asks me if I want to save it appears, but after 
> I press the "Save" button, nothing happends, and it doesn't ask me for 
> the name of the file.
> But if I right-click on that link and chose "Save as..." from the 
> context menu, it always ask me immediately for the name of that file.
> Can you tell me what other headers do I need to print, or what else 
> should I need to do in order to be able to save the file by just 
> clicking the link (pressing enter on it)?
> Thanks.
> Octavian
I do the following:

        $c->res->header('Content-disposition', qq{attachment; 
filename="$name - $date.pdf"});

The only difference I can see there is a space after the ';'

More information about the Catalyst mailing list