This commit is contained in:
Denis Fedoseev 2017-07-31 20:21:03 +03:00
parent 929538f486
commit 3bb9ef5b55

View file

@ -145,6 +145,7 @@ get '/' => sub {
} => 'index'; } => 'index';
# Upload image file # Upload image file
# There is no restriction for file size in app because restriction is present in nginx configuration
post '/upload' => ( authenticated => 1 ) => sub { post '/upload' => ( authenticated => 1 ) => sub {
my $self = shift; my $self = shift;
@ -163,17 +164,6 @@ post '/upload' => ( authenticated => 1 ) => sub {
); );
} }
# Upload max size
#my $upload_max_size = 3 * 1024 * 1024;
# Over max size
#if ($image->size > $upload_max_size) {
# return $self->render(
# template => 'error',
# message => "Upload fail. Image size is too large."
# );
#}
# Check file type # Check file type
my $image_type = $image->headers->content_type; my $image_type = $image->headers->content_type;
my %valid_types = map { $_ => 1 } qw(image/gif image/jpeg image/png); my %valid_types = map { $_ => 1 } qw(image/gif image/jpeg image/png);