sub retrieveFile { my $file = shift; if(not -e $file) { croak "Could not locate file: $file)"; } if(not open(FH, $file)) { croak "Could not open file: $file"; } my $filesize = -s $file; ## Note type will need to change based on the type of file that is ## returned. print $cgi->header(-type=>'application/vnd.ms-excel', -Content-Disposition=>"attachment; filename=$file", -Content_Length=>$filesize); while() { print; } close FH; }