http://qs1969.pair.com?node_id=525580

master_son has asked for the wisdom of the Perl Monks concerning the following question:

Can someone tell me a good method of uploading a csv file via CGI so that I could read its contents with DBI? All I would like to do is get file stored on the server so it can be opened by perl code and read.

Here is a code snippet I created to test interaction in the CGI for getting information on the name and type of file:
use CGI qw(:standard); print "Content-type: text/html\n\n"; &main; sub main() { my $query = new CGI; my $indexTemp = HTML::Template->new(filename => 'index.tmpl'); my $fileName = $query->param('filepath'); my $type = $query->uploadInfo($fileName)->{'Content-Type'}; print $query->param('eventname')."<br />\n"; print $query->param('date')."<br />\n"; print $query->param('starttime')."<br />\n"; print $query->param('endtime')."<br />\n"; print $query->param('location')."<br />\n"; print $fileName."<br />\n"; print $type."<br />\n"; } }
Thank you in advance for your help.
---------------------
Keep your concentration here and now where it belongs - Qui-Gon Jinn