I didn't open $file_name because
my $file_name = param('photo'); yields both a string with the uploaded filename AND an open filehandle to the uploaded file. Explicitly opening it isn't necessary (and it works as-is.) The only thing I pared down from the posted code was the error-handling and name-generating parts of the code.
Testing the open (F, ">$photo_save_name");, although a good idea, isn't a problem. This is the code that works, remember.
My new code does replace while (<$file_name>) with while ( read( $file_handle, $buffer, BUFFER_SIZE ) ) { (but, really, with 30K files and a 16K buffer I'm not really gaining much) but again, that's not what's giving me fits (none of those things break anything.) Why doesn't $CGI::POST_MAX work? Why doesn't upload(), tmpFileName(), and uploadInfo() work? Sigh. And yeah, I checked my CGI installation and installed all the subclasses before posting. Again, sigh.
Gary Blackburn
Trained Killer
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.