Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
The relevant perl:<form action="server.edu/submit.pl?querystring" enctype="multipart/for +m-data" method="post"> <input type="file" name="uploadfile_0" /> <input type="submit" value="upload" /> </form>
It always hits the !$upload catch. If i remove that catch the file is created as an empty 0 byte file. Hopefully its a simple problem that i'm missing out of frustration.my $query = CGI::new(); my $filename = $query->param("uploadfile_0"); next if !$filename; $filename =~ s/^.*[\/\\](.*)/$1/; $filename =~ s/\s/"_"/ge; my $upload = $query->upload("uploadfile_0"); if (!$upload) { $output .= "<p>CGI.pm failed to upload the file.</p>"; next; } open(FILE,">$location/$filename") or die "$!"; binmode FILE; while ( <$upload> ) { print FILE; } close(FILE);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Uploading Files with CGI.pm results in 0 byte files
by imp (Priest) on Nov 19, 2006 at 20:40 UTC | |
by Anonymous Monk on Nov 19, 2006 at 21:21 UTC | |
by friedo (Prior) on Nov 19, 2006 at 21:38 UTC | |
by trwww (Priest) on Nov 21, 2006 at 01:01 UTC | |
by Anonymous Monk on Nov 19, 2006 at 20:56 UTC | |
|
Re: Uploading Files with CGI.pm results in 0 byte files
by barrycarlyon (Beadle) on Nov 20, 2006 at 02:22 UTC |