Re: CGI File Upload Problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 27 Aug 2004 09:33:42 +0100, PFJ <paul@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> Hi,
> 
> > Here's the upload portion of the code. $fh is the file being uploaded that
> > came from the form.
> >
> >         if ($line=<$fh>) {  --> THIS IS THE LINE THAT IS HAVING A PROBLEM
> > UNDER FEDORA BUT WORKS UNDER RH9
> 
> To me, there looks like two things which aren't quite right here. Try
> 
> if ($line eq $fh)
> 
> and see what happens. For some reason, the <$fh> just doesn't look
> right. I could be completely wrong, but unless you've just put $fh in
> the <> for the purposes of this email, it's not hitting the right notes
> here.
> 
> I've seen plenty of CGI scripts go insane due to either incorrect logic
> or just parsing incorrectly. Using eq rather than = may help.

That's almost certainly not the problem. That is perfectly normal Perl
code. It means, read the next line of input from the filehandle $fh
and assign it to $line.

Only suggestion that I would make is that it would more often be written as

while ($line = <$fh>)

but it's quite possible that earlier code will have put Perl into
"slurp mode" so that the whole file is read in on that one call.

As for the original problem, it's impossible to be much help without
seeing the whole program - or, at least, a cut down program that
exhibits the problem.

Dave...



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux