Welcome! Log In Create A New Profile

Advanced

Простой вопрос про встроенный perl и upload модули

October 01, 2011 05:50AM
Есть

location @test {
client_max_body_size 4G;
default_type text/html;
perl hello::handler;
}

location /test {
client_max_body_size 4G;
default_type text/html;
perl hello::handler;
}


    location /upload {
       upload_pass   @test;
        upload_store /mnt;
        upload_pass_form_field "^submit$|^description$|^test$";
        upload_cleanup 400 404 499 500-505;



модуль hello ( стандартный из примера ):

package hello;

use nginx;

sub handler {
    my $r = shift;

    if ($r->request_method ne "POST") {
        return DECLINED;
    }

    if ($r->has_request_body(\&post)) {
        return OK;
    }

    return HTTP_BAD_REQUEST;
}

sub post {
    my $r = shift;

    $r->send_http_header;

    $r->print("request_body: \"", $r->request_body, "\"<br/>");
    $r->print("request_body_file: \"", $r->request_body_file, "\"<br/>\n");

    return OK;
}

1;

__END__

и формочка: ( отправляется с пустым полем file)
<html>
<body>
<form method="POST" enctype="multipart/form-data" action="/test" >
<input type="file" name="file" value="value">
<input type="hidden" name="test" value="value">
<input type="submit" name="submit" value="Upload">
</form>
</body>
</html>


В случае если форма посылается через /test на экран выводится содержимое этой формы. т е все ОК. В случае если посылается /upload в переменной $r->request_body виден кусок вида "------------123121212" и все. Почему так происходит ?

_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

Простой вопрос про встроенный perl и upload модули

Bdfy October 01, 2011 05:50AM

Re: Простой вопрос про встроенный perl и upload модули

Valery Kholodkov October 01, 2011 07:26AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 149
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready