This repository has been archived on 2023-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
Foodloop-Server/uploadimage.pl

30 lines
606 B
Perl
Raw Normal View History

2016-08-12 16:10:42 +00:00
#!/usr/bin/env perl
use Mojolicious::Lite;
use Mojo:Upload;
2016-08-12 16:10:42 +00:00
# /?user=sebastian&pass=secr3t
any '/' => sub {
my $c = shift;
# Query parameters
my $user = $c->param('user') || '';
my $company = $c->param('company') || '';
my $currency = $c->param('currency') || '';
print "$user $company $currency\n";
use Devel::Dwarn;
Dwarn $c->req;
# Failed
$c->render(text => 'db entry data upload failed.');
2016-08-12 16:10:42 +00:00
};
# Uploading Image
post '/upload' => sub {
my $c = shift;
my $upload = Mojo::Upload->new;
say $upload->filename;
$upload->move_to('images/' . $upload->filename);
};
2016-08-12 16:10:42 +00:00
app->start;