Kann es sein, dass du nicht CGI.pm dafür benutzt?
Ja, so ist es ... verwende
Sorry, aber das ist Steinzeit-Perl.
Mal einen eleganten Weg:
Das Formular:
<form name="uploader" action="/cgi-bin/the_script.pl" method="post" enctype="multipart/form-data">
<p>Your name: <input type="text" name="name" value=""></p>
<p>Your comment: <input type="text" name="comm" value=""></p>
<p>The file: <input type="file" name="the_file"></p>
<p><input type="submit" value="submit"></p>
</form>
Und das Script:
use strict;
use diagnostics;
use CGI;
my $cgi = CGI->new;
my $file = $cgi->upload('the_file');
if (!$file) {
print $cgi->header(-status=>$CGI::cgi_error);
exit 0;
}
print $cgi->header( -type => 'text/html', -charset => 'iso-8859-1' ),
$cgi->start_html( -title => 'Uploadform' );
if ($cgi->uploadInfo($file)->{'Content-Type'} ne 'text/plain') {
print $cgi->h1('Error'),
$cgi->p('Text files only');
exit 0;
}
print $cgi->h1('Results'),
$cgi->p('Uploaded by: ', $cgi->param('name')),
$cgi->p('Comment: ', $cgi->param('comm')),
$cgi->start_pre;
print $_ while(<$file>);
print $cgi->end_pre;
So, und nun erklär' mir mal, wo das Problem ist. Oder denkst du an mehrere Uploads auf einen Ritt?
Siechfred