[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#277595: unable to access files uploaded via forms from cgi scripts (perl)



Package: apache2

Howdy,

I've been struggling with this for a while. I migrated a couple servers from
Redhat 9 to Debian/Sarge. Most things went without a hitch, except some of our
web based forms allow file uploads which don't work any longer.  I've tried
this on a few Debian/Sarge machines (currently on a machine with
Apache/2.0.52). The following cgi script demonstrates the problem I'm having.
It failes to return the file handle when I try to use the upload method for the
cgi perl module. I've looked around everywhere trying to figure this out. Since
I didn't find anything, I'm guessing its a bug ;).

<script>
#! /usr/bin/perl -w

use strict;
use warnings;

use CGI;


MAIN:
{

my $option = '';
my $body   = '';
my $html   = '';

if(defined(CGI::param('pg_opt'))){
  $option = CGI::param('pg_opt'); }

if("upload file" eq $option ){
  $fn  = $query->CGI::param('nf::file');
  $fh  = $query->upload('nf::file') or die "unable to stat file upload $@";

  $body = $fn;

}
else{
 $body = "
 <form action=\"http://grok.tv:8080/dbdevel/fs/file/upload_file\"; method=\"post\" enctype=\"multipart/form-data\">
   <table width=\"100%\">
     <tr>
       <td colspan=\"2\">
       <input size=30 type=\"file\" name=\"nf::file\" value=\"\" />

       <input type=\"hidden\"  name=\"pg_opt\" value=\"upload file\" />
       <input type=\"submit\"                value=\"Upload file\" />
       </td>
       </tr>
    </table>
  </form> ";
}
   $html = " <html> <body> $body </body> </html> ";

   print "Content-type: text/html\n\n";

   print $html;

   exit 0;
}

</script>

-- 
---------------------------------------------------------- 
                            | /"\                         
 john harrold               | \ / ASCII ribbon campaign   
 jmh at member.fsf.org      |  X  against HTML mail       
 the most useful idiot      | / \                         
----------------------------------------------------------
 What difference does it make to the dead, the orphans, 
 and the homeless, whether the mad destruction is brought 
 under the name of totalitarianism or the holy name of 
 liberty and democracy?
 --Gandhi
----------------------------------------------------------
  gpg --keyserver keys.indymedia.org --recv-key F65A739E
----------------------------------------------------------



Reply to: