wolf25 has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks,
The $query->start_multipart_form is not working; I’m using the latest Perl version + win2k, however the form was working fine, but I change my Apache server from Apache/2.0.54 to apache OpenSA/1.0.4.
Also I tried to use $query->start_form and it does work, but I need to upload files!
Any idea why CGI doesn’t see the start_multipart_form part?

Replies are listed 'Best First'.
Re: CGI multipart_form not working
by davidrw (Prior) on Sep 02, 2005 at 21:05 UTC
    can you define "not working"? What exactly does it print out? Can you show a code snippet? At worst as a workaround you can do print '<FORM ACTION="foo.cgi" METHOD="post" ENCTYPE="multipart/form-data">', right (and maybe doing that will let it work enough to reveal a different problem)?
      it doesn’t want to pass through, I mean when I click on submit button, it’s only refresh the page, without reading anything.
      Also I tried to use your method, but it still treats it the same way.
      What worrying me is that I went back to my old server, and it works fine, so the problem in the server itself, CGI is fine.
      I note there is no mod_cgi added in the new server, is this a problem?
        What exactly does it print out? Can you show a code snippet?

        Please show the generated output (at least the relevant section), and the respective code snippet. also,
        Is there anything in the error log?
        What happens when you run it from the command line? (same output? any warnings/errors?)
Re: CGI multipart_form not working
by wolf25 (Initiate) on Sep 03, 2005 at 22:01 UTC
    The problem is there is no output I can give, the page just refreshes itself, even in the logs files there is nothing to hold on, however now when I submit the form, the page hangs until I kill it. I don’t know what I did to the server!
    The multipart_form stops the page with no output to operate on, but Im still trying to find something for you.
    Running CGI script in Command line? I haven’t done it before, I’ll try
    Also I tried the “application/x-www-form-urlencoded” which is the older version, but no luck
    Ok the page is about 700 line of code, so I’ll show you the important bits:
    And tell me of it’s not enough, I will send it all.

    #--check of the form is submitted
    if ($ENV{'REQUEST_METHOD'} eq "POST") {
    #----set the limited size of the file(s) to be uploaded, the max file(s) size is 300 KB
    our $limit = 300000;
    #---retrieve the file(s) size from the client side:
    our $content_length = defined $ENV{'CONTENT_LENGTH'} ? $ENV{'CONTENT_LENGTH'} : 0;
    #--do some validation stuff if if if and store some data into the database à
    }

    #---start the form:

    print $query->start_multipart_form(-method=>'post', -action=>'http://localhost/cgi-bin/cars/add_car.pl' );
    #--car name fieldà
    #--car model, color bla blaà
    #--car picture:
    print $query->filefield(-name=>'uploaded_file', -size=>70, -maxlength=>140), '
    ';
    print p(reset, submit('submit', 'Submit'));
    print $query->end_ multipart_form;


    Thanks for your support dud.
    I really need it.