Unless you run your own server, this may not work because the web host may
not have decided to update their version of Perl or CGI.pm yet.
For instance, my hosting service is still using Perl 5.005_03 with CGI.pm
version 2.46. So I tried the preferred upload method with no success. The
previous m
--- 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 $uploa
Ovid wrote at Fri, 14 Jun 2002 16:43:51 +0200:
> 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');
>
> [
Crud! This is what I get for typing a program directly into a browser window :)
> for ( 1 .. 5 ) {
> if ( my $file = $q->param( "file$_" ) {
> my $filename = basename( $file );
> open FILE, "> $user->{'site_id'}/$filename" or error(...);
>
--- 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 Filehand
Links On Web wrote at Fri, 14 Jun 2002 07:20:17 +0200:
> for some reason when, I do this it doesnt print any thing, it just makes the file.
>
> sub uploadfile {
> for ($i=1; $i<=5; $i++) {
> if ($q->param("file$i")) {
> $filename = $q->param("file$i");
> $file = $q->param("
Oh! Upon re-reading I realize you probably meant that
nothing is printed to the file, you are just getting
an empty file created. Sorry for misunderstanding.
Unfortunately, I don't have any experience in
uploading files, so I'm sure that others on this list
can be of more help than I can. (In fac
True. The only print statement I see here is the one
which prints the contents of $uploaded to FILE. Maybe
after you do this, you want to either print out an
HTML response or redirect to another page? If so, you
need to write more code to do that.
- John
--- LinkS On WeB <[EMAIL PROTECTED]> wrot