7 Feb
2011
7 Feb
'11
12:27 a.m.
Hi All, I was having terrible trouble using send_file and the Content-Disposition header. I found that I needed to set the Content-Disposition header manually in the reponse object returned from send_file. get '/myfile' => sub { my $response = send_file('/some/file.jpg'); $response->header('Content-Disposition', "attachment; filename=some_other_file.jpg"); return $response; } Although this works and I have no problems doing it, it seems counter intuative. I would rather do: get '/myfile' => sub { header "Content-Disposition" => "attachment; filename=some_other_file.jpg" ; send_file('/some/file.jpg'); } In the highly likely event I am doing something wrong can someone let me know ? Cheers Matt.