my $query = new CGI; if ($query->param("Submit")){ die; my ($buff, $size, $bytes_read, $title, $description); my $data = 0; my $TOTAL_BYTES = 0; my $file = $query->upload('file'); my $type = $query->uploadInfo($file)->{'Content-Type'}; if (!$file && $query->cgi_error) { $err_msg .= $query->header(-status=>$query->cgi_error); &printhtml; } unless ($type =~ /image/){ $err_msg.="You may only upload image files to this server.
"; &printhtml; } if ($query->param("title")){$title=$query->param("title");} if ($query->param("description")){$description=$query->param("description");} if (!$title or !$description or !$file){ $err_msg.="Missing title or description.
"; &printhtml; } binmode STDIN; binmode STDOUT; open (SAVE, ">C:\temp\upload.jpg"); binmode SAVE; while (read($file,$data,1024)) { #$TOTAL_BYTES += $Bytes; #if (($TOTAL_BYTES > $MAXIMUM_UPLOAD) && ($MAXIMUM_UPLOAD > 0)) { # $i1 = 1; # last; #} print SAVE $data; } close SAVE;