Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
my $pdf_name = $cgi_query->param('event_pdf'); my $pdf = 'EventPDF'; if ($pdf_name){ #A file (supposedly a PDF) has been sent in the + post data. Load it into $pdf for storage in events table binmode($pdf_name); while (<$pdf_name>){ $pdf .= $_; } $pdf = $db->quote($pdf); } my $mime_type; #(Not very robust) type checking for uploaded file. This is depen +dent on the browser behaving $mime_type = $cgi_query->uploadInfo($pdf_name)->{'Content-Type'} i +f $pdf_name; if ($mime_type){ return $self->display_error("Attached file is not a PDF\n") un +less $mime_type eq 'application/pdf'; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Object Label Badly Formatted
by digger (Friar) on Mar 05, 2005 at 02:46 UTC | |
|
Re: Object Label Badly Formatted
by Anonymous Monk on Mar 05, 2005 at 01:00 UTC | |
by Tanktalus (Canon) on Mar 05, 2005 at 15:35 UTC |