[cgiapp] redirect/content type

Ron Savage ron at savage.net.au
Wed Jun 11 20:10:34 EDT 2008


Hi Ben

> Some way to set BOTH a redirect and a content-type?   Or simply fake  
> the name name of the file?

I don't have a redirect, but here's how I let users download search
results:

sub download_staff_list
{
my($self)	= @_;
my($entity_id)	= $self -> session_param('entity_id');
my($data)	= $self -> build_staff_list_data($entity_id, 1);

$self -> header_type('none');

print "Content-Disposition: attachment; filename = staff-list.csv\n\n";
print map{join(',', map{qq|"$$_{'td'}"|} @{$$_{'td_loop'} }) . "\n"}
@$data;

return '';

} # End of download_staff_list.

-- 
Ron Savage
ron at savage.net.au
http://savage.net.au/index.html




More information about the cgiapp mailing list