Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: Re: Re: Re: CGI::Minimal does not work with enctype="multipart/form-data"?

by relax99 (Monk)
on Oct 21, 2002 at 12:20 UTC ( #206825=note: print w/replies, xml ) Need Help??

in reply to Re: Re: Re: CGI::Minimal does not work with enctype="multipart/form-data"?
in thread CGI::Minimal does not work with enctype="multipart/form-data"?

I'm using CGI::Minimal version 1.09. I used ppm to install it, just tried reinstalling it - didn't help. My perl is ActiveState distribution (v5.6.1 built for MSWin32-x86-multi-thread). I'm using a Windows 2000 Professional system with IIS webserver installed on it.

I have just tried running the code you gave me - still doesn't finish. And below is the code I used for tests before:

To test file upload using - successful

# to test form upload using - works fine! use strict; use warnings; use CGI; my $cgi = CGI->new; print "Content-Type: text/html\n\n"; print "<body><html>\n"; my $fh = $cgi->upload("file1"); print <$fh>; print "</body></html>\n"; exit(0);

To test file upload using CGI::Minimal - does't work!

# to test form upload use strict; use warnings; use CGI::Minimal; my $cgi = CGI::Minimal->new; print "Content-Type: text/html\n\n"; print "<body><html>\n"; print $cgi->param("file1"); print "</body></html>\n"; exit(0);

Below is html for the form

<html> <head> <title>CGI::Minimal test</title> </head> <body> <form enctype="multipart/form-data" action="/cgi-bin/" method +="post"> <input type="file" name="file1"> <input type="submit" value="Submit"> </form> </body> </html>

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: CGI::Minimal does not work with enctype="multipart/form-data"?
by relax99 (Monk) on Oct 24, 2002 at 12:42 UTC

    I figured out my problem. In order to my CGI::Minimal work on my Windows 2000 system I need to initialize $cgi object this way:

    binmode STDIN; # CGI::Minimal will freeze without it with multipart/fo +rm-data forms my $cgi = CGI::Minimal->new;

    Once you do that, it works like a charm.

      Wonderful, thanks for telling that to us! Please send a bug report to CGI::Minimal's author.

      Ciao, Valerio

        Well, is it really a bug or is it the intended behavior? I consider my knowledge of Perl to be intermediate, so I'm cautious to imply that he didn't indend that to happen. I did email him with the original description of the problem to the email I found in CGI::Minimal docs, but I haven't received a response.

        Btw, below is a piece of discussion from comp.lang.perl.misc:

        I wrote:
        - As soon as I add enctype="multipart/form-data" to my form tag, my script that uses CGI::Minimal never finishes. I know the problem is in CGI::Minimal, because and direct read from STDIN work just fine.

        Someone replied:
        - Why? Because it works one but not on the other? That's not a firm argument. Perhaps it is in your code! CGI::Minimal has proved to me to be a fine piece of code. I recommend you don't vent your opinion in this way to the CGI::Minimal author.

        To sum it up, I'm glad I can keep using CGI::Minimal

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://206825]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2021-05-06 12:48 GMT
Find Nodes?
    Voting Booth?
    Perl 7 will be out ...

    Results (74 votes). Check out past polls.