Jörk: Bild uploaden geht nicht

Beitrag lesen

hallo,

bis jetzt hab ich damit noch nie was zu tun gehabt, aber jetzt muss ich ein bild über ein formular uploaden.

hier mein programmcode:

was ist da falsch?

#!/usr/bin/perl -w

use strict;
use CGI::Carp qw(fatalsToBrowser);
use CGI;

my $q = new CGI;

my $file = $q->param('pic');
my $data;

open(FH, ">1234567.gif") or die $!;

#binmode $file;
#binmode FH;

while(read($file,$data,1024)) {
print FH $_;
}

close FH;

print "Content-type: text/html\n\n";
print "<h1>Die Datei $file wurde erfolgreich hochgeladen.</h1>\n";
print "Die Datei $file wurde erfolgreich auf dem Server gespeichert.\n";