You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by cbell <cb...@lighthouseasp.com> on 2000/12/28 20:21:03 UTC

File Upload problems

Hello everyone, I was hoping someone could give me a hand with file
uploads in mod perl.  Everytime I try to upload a file, the browser will
stall a couple of times, and the file ends up on the server as a zero
byte file.  I'm pretty sure this is a binmode problem,
and I've tried it a bunch of different ways, but nothing seems to work.
I've included the code for my upload form and my upload procedure.  If
anyone can shed any light on this problem I'd really appreciate it!!!
Thanks alot!!!!

##### Display upload form
$query = new CGI;
print $query->start_multipart_form;
print $query->filefield('uploaded_file','file',50,256);
print $query->submit('SubmitUpload','Upload');
print $query->endform;

################# Upload Procedure
my $buffer;
my $inputfile = param('uploaded_file');
open (OUTFILE,">$ENV{DOCUMENT_ROOT}/images/test.gif") ;
binmode OUTFILE;
binmode $inputfile;
while (read($inputfile,$buffer,1024))
    {
        print OUTFILE $buffer;
    } ## end while


Re: File Upload problems

Posted by cbell <cb...@lighthouseasp.com>.
I think that was it!!! I wasn't closing the file after uploading it,
thanks alot!!!!



"Alexander Farber (EED)" wrote:

> cbell wrote:
> > Everytime I try to upload a file, the browser will
> > stall a couple of times, and the file ends up on the server as a zero
> > byte file.
>
> How about:
>
> > ################# Upload Procedure
> > my $buffer;
>
>   my $inputfile = upload ('uploaded_file');
>
>   open (OUTFILE,">$ENV{DOCUMENT_ROOT}/images/test.gif")
>      or die "Can not write to file because of $!";
>
> > binmode OUTFILE;
> > binmode $inputfile;
> > while (read($inputfile,$buffer,1024))
> >     {
> >         print OUTFILE $buffer;
> >     } ## end while
>
>   close OUTFILE;


Re: File Upload problems

Posted by "Alexander Farber (EED)" <ee...@eed.ericsson.se>.
cbell wrote:
> Everytime I try to upload a file, the browser will
> stall a couple of times, and the file ends up on the server as a zero
> byte file.  

How about:

> ################# Upload Procedure
> my $buffer;

  my $inputfile = upload ('uploaded_file');

  open (OUTFILE,">$ENV{DOCUMENT_ROOT}/images/test.gif") 
     or die "Can not write to file because of $!";

> binmode OUTFILE;
> binmode $inputfile;
> while (read($inputfile,$buffer,1024))
>     {
>         print OUTFILE $buffer;
>     } ## end while

  close OUTFILE;

Re: File Upload problems

Posted by cbell <cb...@lighthouseasp.com>.
I tried it with and without binmode with the same results, thats why I
figured I was using binmode wrong.


"G.W. Haywood" wrote:

> Hi there,
>
> On Thu, 28 Dec 2000, cbell wrote:
>
> > It is Mod perl 1.24_01, perl 5.005_03, and Apache 1.3.14 running on
> > Redhat 6.2.
>
> Hmmm.  Do you need to use binmode() at all?  If you didn't,
> then you probably wouldn't get any binmode problems...
>
> perldoc -f binmode
>
> 73,
> Ged.


Re: File Upload problems

Posted by "G.W. Haywood" <ge...@www.jubileegroup.co.uk>.
Hi there,

On Thu, 28 Dec 2000, cbell wrote:

> It is Mod perl 1.24_01, perl 5.005_03, and Apache 1.3.14 running on
> Redhat 6.2.

Hmmm.  Do you need to use binmode() at all?  If you didn't,
then you probably wouldn't get any binmode problems...

perldoc -f binmode

73,
Ged.


Re: File Upload problems

Posted by cbell <cb...@lighthouseasp.com>.
It is Mod perl 1.24_01, perl 5.005_03, and Apache 1.3.14 running on
Redhat 6.2.


"G.W. Haywood" wrote:

> Hi there,
>
> On Thu, 28 Dec 2000, cbell wrote:
>
> > I'm pretty sure this is a binmode problem,
>
> Did I miss the bit where you told us which operating system, Perl
> version, and all that good stuff?  If you search around in the
> mod_perl directory you should find a file called SUPPORT.
>
> :)
>
> 73,
> Ged.


Re: File Upload problems

Posted by "G.W. Haywood" <ge...@www.jubileegroup.co.uk>.
Hi there,

On Thu, 28 Dec 2000, cbell wrote:

> I'm pretty sure this is a binmode problem,

Did I miss the bit where you told us which operating system, Perl
version, and all that good stuff?  If you search around in the
mod_perl directory you should find a file called SUPPORT.

:)

73,
Ged.



Re: Undefined subroutine

Posted by ___cliff rayman___ <cl...@genwax.com>.
it's telling you to search the guide at:
http://perl.apache.org/guide/

check out in particular:
http://thingy.kcilink.com/modperlguide/troubleshooting/Undefined_subroutine_Apache_RO.html

Barry Veinotte wrote:

>
>
> Undefined subroutine &Apache::ROOT::cgi_2dbin::ads1::ads_2epl::handler
> called at /usr/lib/perl5/site_perl/5.005/i386-linux/Apache/Registry.pm line 135.
>

--
___cliff rayman___cliff@genwax.com___http://www.genwax.com/



RE: Undefined subroutine

Posted by Barry Veinotte <ba...@veinotte.com>.
I may have found the answer.... 
http://perl.apache.org/dist/cgi_to_mod_perl.html
the perl version is 5.003 and from what I have read
in the guide 5.003 and mod_perl don't make life easy
for cgi scripts. 

Would my problems be taken care of if Perl were 
upgraded to 5.004 ? Is there any hope of getting things
running properly with 5.003?

Barry


> -----Original Message-----
> From: Barry Veinotte [mailto:barry@veinotte.com]
> Sent: Thursday, December 28, 2000 2:44 PM
> To: modperl@apache.org
> Subject: Undefined subroutine
> 
> 
> Hi folks,
> 
> I am trying to get a program to run under mod_perl using Apache::Registry
> and am getting the following error:
> 
> Undefined subroutine &Apache::ROOT::cgi_2dbin::ads1::ads_2epl::handler
> called at /usr/lib/perl5/site_perl/5.005/i386-linux/Apache/Registry.pm line 135.
> 
> I am working with Red Hat Linux  6.2
> 
> I am totally new to this, and have no idea what this error is telling me.
> If someone could point me in the right direction I would greatly appreciate it.
> 
> Thanks,
> Barry
> 
> 
> 

Undefined subroutine

Posted by Barry Veinotte <ba...@veinotte.com>.
Hi folks,

I am trying to get a program to run under mod_perl using Apache::Registry
and am getting the following error:

Undefined subroutine &Apache::ROOT::cgi_2dbin::ads1::ads_2epl::handler
called at /usr/lib/perl5/site_perl/5.005/i386-linux/Apache/Registry.pm line 135.

I am working with Red Hat Linux  6.2

I am totally new to this, and have no idea what this error is telling me.
If someone could point me in the right direction I would greatly appreciate it.

Thanks,
Barry