Hi all,

After thinking I had my probs straightened out, I ran into one I can't really seem to find any info on....

When running the script below, I get Short Read: wanted 437, got 0

My brain, which is admittedly a little fried today, guesses that the script is not getting the bytes it expects. Hence the "wanted 438, got 0" part.

The question I have now, is can anyone spot where the problem lies or know what can cause this error?

Thanks!
Jim

#!/usr/local/bin/perl use CGI; $query = new CGI; print $query->header; print $query->start_html(-title=>"UPLOAD PLEASE"); # retrieve the upload file name. unless ($file = $query->param('fileID')) { &showError('No file name specified.'); } @pathName = split(/\\/,$file); $newFile ='/home/users/web/b2578/pow.royridgeway/htdocs/Roy/'; $newFile .= pop(@pathName); open(OPF,">$newFile") || &showError("Failed to open OPF, $!"); print "<P><CENTER>Uploading <BR>$fileID <BR>to<BR>$newFile<BR></CENTER +></P>\n"; while ($bytesread=read($file,$buffer,1024)) { print OPF "$buffer"; } close OPF; print $query->end_html; }

In reply to Short read error? by JimJx

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.