in reply to file from multipart form not being written to the server!
I think antirice is correct. This would have been caught if you been using strict, but with strict in place you are also unable to use the filename returned by param() as a filehandle. You probably want to consider using the upload() method instead:
#!/usr/bin/perl -w use strict; use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser); use File::Basename; my $fh = upload('userfile'); my $filename = param('userfile'); my ( undef, undef, $ext ) = fileparse($filename, '\.\w+$'); $filename = time() . $ext; open OUTFILE, "> /tmp/$filename" or die "/tmp/$filename - $!\n"; binmode OUTFILE; binmode $fh; print header('text/html'), start_html(), p("filename : $filename (saved in /tmp)"); while (<$fh>) { print OUTFILE $_; } print end_html();
/J\
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: file from multipart form not being written to the server!
by AztecMonkey (Initiate) on Jun 23, 2003 at 00:31 UTC |