Hello,
I am creating upload file manager app with Mojolicious and I am seeing
unexpected behavior running the following code
from http://mojolicious.org/perldoc/Mojolicious/Guides/Tutorial#File-uploads
When a file with size under 16MB is uploaded, everything works fine, but
when a file larger then 16MB is uploaded (which is the default max) I am
expecting to see "File is too big." message, instead I am getting
connection reset. I know I can increase the maximum file size limit but
that is not my goal here, I just want to make sure this code works as
expected.
I am building the app using: mojo generate lite_app file_name.pl and I am
testing it on a morbo server.
My perl and mojo versions are:
Perl (v5.24.0, darwin)
Mojolicious (7.62, Doughnut)
Thank you.
#!/usr/bin/env perl
use Mojolicious::Lite;
# Upload form in DATA section
get '/' => 'form';
# Multipart upload handler
post '/upload' => sub {
my $c = shift;
# Check file size
return $c->render(text => 'File is too big.', status => 200)
if $c->req->is_limit_exceeded;
# Process uploaded file
return $c->redirect_to('form') unless my $example = $c->param('example');
my $size = $example->size;
my $name = $example->filename;
$c->render(text => "Thanks for uploading $size byte file $name.");
};
app->start;
__DATA__
@@ form.html.ep
<!DOCTYPE html>
<html>
<head><title>Upload</title></head>
<body>
%= form_for upload => (enctype => 'multipart/form-data') => begin
%= file_field 'example'
%= submit_button 'Upload'
% end
</body>
</html>
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.