in reply to Net::FTP and param()

Take a look at the following nodes for examples of this:
File Upload + recording "metadata"
Reaped: Re: I need a script for web file uploading.
I need a script for web file uploading.

You'll probably need to say $C=new CGI; somewhere and param('file') should be $C->param("file"). $C->param("file") will give you a file handle not the file, so $ftp->put will probably go crazy on that.


/brother t0mas

Replies are listed 'Best First'.
Actually...
by Anonymous Monk on Aug 15, 2000 at 10:38 UTC
    I just found out you should use the new upload() function. This still didn't fix the problem, however and I tried your solution, too.
      Try with at temporary file:
      my $C = new CGI; my $filehandle = $C->upload('file'); open OUTFILE, ">/tmp/tmpfile" or die "Can't create: $!"; while (<$filehandle>) {print OUTFILE;} close OUTFILE or die "Can't close: $!";
      and then the ftp stuff with $ftp->put('/tmp/tmpfile').
      This will of cause not be good enough in a multi-user environment, where you'll need to handle simultaneous uploads. You will have to create a unique temporary name, perhaps with File::MkTemp.

      /brother t0mas