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.

In reply to Re: CGI file upload - endless loop?? by lpoht
in thread CGI file upload - endless loop?? by lpoht

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.