--- Ovid <[EMAIL PROTECTED]> wrote: > --- Janek Schleicher <[EMAIL PROTECTED]> wrote: > > I'm also not an expert of uploading files. > > But you do two things to read the file: > > > > $file = $q->param("file$i"); > > Now $file contains a string. > > > > Then you use something like > > my $uploaded = <$file>; > > > > So now you use $file as a Filehandle, > > but in fact it's still a simple stupid string. > > It would seem that way, but this is not the case. > From the CGI.pm documentation: > > When the form is processed, you can retrieve the > entered filename > by calling param(): > > $filename = $query->param('uploaded_file'); > > [snip] > > The filename returned is also a file handle. You > can read the > contents of the file using standard Perl file > reading calls: >
In fact, there is now another way! According to _CGI Programming with Perl_ ("The Rat Book"?), 2nd Edition, Chapter 5, you can also get the file handle via the new "upload" method, passing it the filename parameter. From page 99: "The upload method was added to CGI.pm in Version 2.47. Prior to that, you could use the value returned by 'param' as a file handle in order to read from the file. This actually still works, but there are conflicts with strict mode and other problems, so 'upload' is the preferred way to get a file handle now." - John ===== "Now it's over, I'm dead, and I haven't done anything that I want; or, I'm still alive, and there's nothing I want to do." - They Might Be Giants, http://www.tmbg.com __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]