in reply to (Ovid) Re: CGI.pm file upload freaking me out
in thread CGI.pm file upload freaking me out

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