I've tried to use parse_on_demand as shown in: http://search.cpan.org/~flora/Catalyst-Runtime-5.80007/lib/Catalyst.pm#ON-DEMAND_PARSER
However, I can't seem to stop the upload. I'm testing this simply by creating an action that dies immediately, however the browser seems to upload the very large file I've selected before it ever reaches my action:
sub upload :Local {
my ($self, $c) = @_;
die;
# What I'd like to do is this:
# if ($c->req->header('Content-Length') > $some_limit) {
# die "Upload too large";
# }
# ... check filename extension and mime-type...
}
Is this the right way to approach upload validation?