SoupNazi has asked for the wisdom of the Perl Monks concerning the following question:
Hi there, I am in need of a little bit of help. I am attempting to write a file up-load CGI script to go with a form I've written, and I can't seem to get the file up-load to work properly.
Let me show you what I mean, the code below is the up-load section of a test CGI script I wrote:
my ( $fil, $bts, $bfr, $dta, $tru, ); $fil = $cgi->param('file'); while ($bts = read($fil, $bfr, 1024) || croak "Oops! $!") { $dta .= $bfr; } $hdr = $cgi->header({type=>"text/html"}); $cnt .= $cgi->start_html(); $cnt .= $cgi->p("Here's the data: "); $cnt .= $dta; $cnt .= $cgi->end_html(); print $hdr, $cnt; exit 0;
Now ... when the form is submitted, the script croaks with this error:
"Software error: Oops! Bad file descriptor at test.cgi line 30" ... "Bad file descriptor"
it happens with .txt files, .doc files, .jpg files, etc.
Could someone kindly fill me in on what exactly I'm doing wrong? I'd appreciate your time.
The web serever is Apache2, running on Kubuntu Linux Dapper Drake.
Thank you again for you time, I'm stumped.
-s0up
Code tags added by GrandFather
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Up-Loading Files From Multi-Part Form
by sgifford (Prior) on Sep 14, 2006 at 05:04 UTC | |
|
Re: Up-Loading Files From Multi-Part Form
by zentara (Cardinal) on Sep 14, 2006 at 11:06 UTC | |
|
Re: Up-Loading Files From Multi-Part Form
by gellyfish (Monsignor) on Sep 14, 2006 at 07:59 UTC |