in reply to File upload under Apache2

Don't make it more difficult than necessary: CGI::Simple has a file upload() method. Have a look at the FILE UPLOADS section of the documentation.

Update: Or even easier: CGI::UploadEasy or CGI::Upload.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^2: File upload under Apache2
by Anonymous Monk on Aug 16, 2010 at 09:34 UTC
    CGI::Simple uses the exact same interface as CGI, and CGI::UploadEasy and CGI::Upload aren't any easier to use
      Beauty or (ease of use) is in the eye of the beholder and sometimes things need to be repeated before they sink in.

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      Minor quibble. It's not "the exact same interface".

      From the docs:

      By utilizing a new feature of the upload method this process can be si +mplified to: $ok = $q->upload( $q->param('upload_file1'), '/path/to/write/file. +name' ); if ($ok) { print "Uploaded and wrote file OK!"; } else { print $q->cgi_error(); } As you can see upload will accept an optional second argument and will + write the file to this file path. It will return 1 for success and u +ndef if it fails. If it fails you can get the error from cgi_error.
      imo, a nice improvement.