After scaning SuperSearch and trying all the ways, I can't figure out what's wrong.
Template file
<HTML>
<HEAD>
<TITLE>Upload</TITLE>
</HEAD>
<BODY>
<FORM ACTION="/perl-cgi/upld" METHODE="POST" ENCTYPE="multipart/form-
+data">
<INPUT TYPE="FILE" NAME="datei">
<P>
<INPUT TYPE="SUBMIT">
</BODY>
</HTML>
cgi file
#!/usr/bin/perl
use warnings;
use strict;
use HTML::Template;
use CGI;
my $template = HTML::Template->new(filename => 'upld.tmpl');
my $cgi = new CGI;
if ($cgi->param('datei')) {
loadpic($cgi);
exit;
}
print "Content-Type: text/html\n\n";
print q(<link rel="stylesheet" type="text/css" href="/pds392/style.css
+"> <style type="text/css"></style>);
print $template->output;
sub loadpic {
my $cgi = shift;
my $file = $cgi->param('datei');
my $fh = $cgi->upload('datei');
print "<HTML><BODY>$file<br></BODY></HTML>";
open OUT, ">/tmp/1.pic.jpg";
my $buffer;
while (read $fh, $buffer, 512) {
print OUT $buffer;
}
print "Content-Type: text/html\n\n";
close OUT;
exit;
}
my $fh is allways undef and the script dies, but $file contains the choosen filename!!!
Why ? Can this behavior result of using this script with mod_perl ? Or is there something I've missed ?
Cheers
-----------------------------------
--the good, the bad and the physi--
-----------------------------------