From: WC -Sx- Jones <[EMAIL PROTECTED]> > Mark Martin wrote: > > Hi, > > I've got a web form that allows a user to browse to an excel file on > > their computer and input it and the year as parameters to run a perl > > script > > > > FORM : > > > > <input type="file" value="excel" name="file" size="15"> > > > How do you know that the filename will be less than 16 characters?
It's "size", not "maxlength". Nothing prevents anyone to enter as long a name as he/she likes :-) > > <input type="text" name="year" size="15"> > > > > SCRIPT: > > > > use CGI; > > use Spreadsheet::ParseExcel; > > $q=new CGI; > > > > my $oExcel = new Spreadsheet::ParseExcel; > > my $user_ssheet=$q->param('file'); > > my $oBook = $oExcel->Parse($user_ssheet); > > my $year=$q->param('year'); > > > > BUT I keep getting a "HTTP 500 - Internal server error". However if > > I hard code in the reference to the excel file, like so : > > > Have you tried using "fatalsToBrowser" > Also, what does your server logs say about the error? In either case you should read perldoc -f eval and perldoc -f die You definitely do want to wrap the $oExcep->Parse() in an eval {} block and catch the exceptions/errors. In this case I think the problem is that $oExcel->Parse() expects a path to an existing file, but $user_ssheet is not. It's the original name of the file. The data are at this point in a temp file with a totally different name&path. So you want something like this: if ($user_ssheet ne ""){ # there is an uploaded file $tmp_file = $q->tmpFileName($user_ssheet); my $oBook = $oExcel->Parse($tmp_file); ... } HTH, Jenda ===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz ===== When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>