in reply to Re: How do I parse multipart/form-data?!?
in thread How do I parse multipart/form-data?!?

Thanks for the assistance! I've tried to fiddle with my code and this is what I have ($dat is the upload filename):
$udt = $que->upload($dat); open PAGE, ">$pgp$pgn"; # while (<$udt>) { print PAGE $_; } while (read($udt, $buf, 16384)) { print PAGE $buf; } close PAGE;
It doesn't get past the upload line. I've checked other posts so I tried to just run $que->uploadinfo; to see if It would return anything and it kills the whole thing too. The only difference I saw (after much perusal) between our code was the use line where I have use CGI qw(:standard); so I tried to change it to just use CGI; like you have and it failed immediately. What's the difference between the use parameter options and is this the reason why my upload() kills the script? What do I have to do to be able to just use CGI;? Thanks again for any further help. This is way harder than I thought it would be. TTFN & Shalom.

-PipTigger

p.s. My bad! I just got it to werk! I love lerning new Perl! =) The problem was I didn't need upload at all. This werks great:
#!/usr/bin/perl use CGI qw(:standard); my $dat = param("upfilenm"); my $pgn = param("pagename"); open PAGE, ">/usr/local/pagez/$pgn"; while (<$dat>) { print PAGE $_; } close PAGE;
NiceNice!

Replies are listed 'Best First'.
RE: RE: Re: How do I parse multipart/form-data?!?
by takshaka (Friar) on Jun 08, 2000 at 10:53 UTC
    upload() is a newer method. If you're using a CGI.pm version earlier than 2.47 (say, from a standard install of Perl 5.005_3 or previous) you won't have it.

    You can still retrieve the filehandle using param().... oh, as I see you found out. There is a danger that on failed uploads param() will return a string only (one that isn't a filehandle) so your reads will fail. Upgrade to the current CGI.pm (if you can) and use upload() to be safe.

RE: RE: Re: How do I parse multipart/form-data?!?
by chromatic (Archbishop) on Jun 08, 2000 at 05:27 UTC
    If you use standard when importing CGI, it'll import the functions into your name space, so you can probably get by with: $udt = upload($dat); I presume you're not using the object-oriented interface, but that's just a guess.