Below I have pasted a run mode from one of my applications. The sub
grabs a report from a database and then returns it to the user. It
works fine under Firefox, but under IE I get a dialogue box asking
whether I want to save or open the file; if I choose to open the file it
isn't recognized as an Excel workbook, and if I choose to save it is
wants to save it as type .pl, based on the name of the instance script.
Is there a way to fix this?
--TWH
sub show_report{ #SELECT already-generated report from reports.
Report is a BLOB that holds an Excel workbook
#Reports are generated every minute by a cron
job, so if no report is available for an event instruct user to try
again in a few minutes
my $self = shift;
my $cgi_query = $self->query();
my $session = $self->param('session');
my $sid = $self->param('sid');
my $db = $self->param('my_db');
#Load permissions and other info from session
my $employeeID = $session->param('EmployeeID');
my $is_create = $session->param('er_create');
if (!$is_create){
return $self->display_error("Insufficient permission to
view report. Please contact administrator.\n");
}
my $event_id = $cgi_query->param('event_id');
my $db_sth = $db->prepare("SELECT Report FROM reports WHERE
EventID=?;") || return $self->display_error($DBI::errstr);
$db_sth->execute($event_id) || return
$self->display_error($DBI::errstr);
my $report_ref = $db_sth->fetchrow_arrayref() || return
$self->display_error("Report not yet generated. Please try again in
five minutes\n");
$self->header_add(-title => 'Event Report');
$self->header_add(-type => 'application/xls');
return $report_ref->[0];
} #End sub show_report
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.