Skip to content

Commit

Permalink
added exception handling to upload example
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Dec 2, 2011
1 parent 57b3786 commit 6c3ac4c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/Mojolicious/Lite.pm
Expand Up @@ -661,6 +661,12 @@ C<250KB> will be automatically streamed into a temporary file.
any '/upload' => sub {
my $self = shift;
# Check file size
return $self->render(text => 'File is too big.', status => 200)
if $self->req->is_limit_exceeded;
# Process uploaded file
if (my $example = $self->req->upload('example')) {
my $size = $example->size;
my $name = $example->filename;
Expand Down

0 comments on commit 6c3ac4c

Please sign in to comment.