better error reporting on unparsable filenames
[freeside.git] / httemplate / misc / upload-batch.cgi
1 <%
2
3   my $fh = $cgi->upload('batch_results');
4   my $filename = $cgi->param('batch_results');
5   $filename =~ /^.*[\/\\]([^\/\\]+)$/ or die "unparsable filename: $filename\n";
6   my $paybatch = $1;
7
8   my $error = defined($fh)
9     ? FS::cust_pay_batch::import_results( {
10         'filehandle' => $fh,
11         'format'     => $cgi->param('format'),
12         'paybatch'   => $paybatch,
13       } )
14     : 'No file';
15
16   if ( $error ) {
17     %>
18     <!-- mason kludge -->
19     <%
20     eidiot($error);
21 #    $cgi->param('error', $error);
22 #    print $cgi->redirect( "${p}cust_main-import.cgi
23   } else {
24     %>
25     <!-- mason kludge -->
26     <%= header('Batch results upload sucessful') %> <%
27   }
28 %>
29