in reply to CGI file upload - endless loop??

Here is the important part of the code:
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. +<BR>"; &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.<BR>"; &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;
the third line (die;) never executes. I'm quite new to perl, so I've been trying all sorts of different file upload methods and don't know if this one even works in theory, let alone reality. Thanks for all of your help.