Hi all,
Sorry if this is not the right place to this question.
I have some issues regarding your module
POE:Component::Server::HTTPServer and would like to see if you can help me. Also, if there's a better/simple way to do this using a different POE module, please let me know.
I am trying to handle a simple file upload form like this one:
(Taken from http://www.cs.tut.fi/~jkorpela/forms/file.html )
<form action=" <...some url...> " enctype="multipart/form-data" method="post"><p> Type some text (if you like):<br> <input type="text" name="textline" size="30"></p><p> Please specify a file, or a set of files:<br> <input type="file" name="datafile" size="40"></p><p> <input type="submit" value="Send"></p></form>
I have this perl code for the HTTPServer:
my $webserver = POE::Component::Server::HTTPServer->new(
Inline_states => {
_start => sub {
my ( $kernel, $session, $heap ) = @_[ KERNEL, SESSION, HEAP ];
print "WEB_SESION>$session->ID()<<\n";
}
},
handlers => (['/' => new_handler( 'ParameterParseHandler' ),
'/process' => \&handle_the_form,
<....Some extra handlers...>
'/' => new_handler('StaticHandler', './'),
]),
);$webserver->create_server();
I use this subroutine to process the request:
sub handle_the_form {
my ($kernel, $heap, $session) = @_[KERNEL, HEAP, SESSION];my $loadfile = "";
my $context = shift;
$context->{response}->code(200);
$loadfile = $context->{param}->{LoadFile} || "UNDEF";
print "$loadfile\n";<...some extra stuff... >
$context->{response}->content( $webpage );
return H_FINAL;
};And I get this:
XXX Don't know how to handle POST content encoding: multipart/form-databoundary=----------ayROB05pfrwzfA6BbX7lHSVbPHLTvDYVAxsLxvAbm6aSFgbqBjaS933 UNDEF
Then my question is, how to handle those "multipart/form-data" responses?
BTW, I am very new into the Perl Objects field (and OOP in general), so please if you can take that into account to be as detailed as humanly possible... ;-)
Thanks in advance for any help,
Federico.
