+ $c->render(json => { url => 'http://127.0.0.1:3001/upload' });
+ my $url = Mojo::URL->new('http://127.0.0.1:3001/upload');
+ $c->redirect_to('http://127.0.0.1:3001/upload');
+ return $c->render(text => 'File is too big.', status => 200)
+ if $c->req->is_limit_exceeded;
+ # Process uploaded file
+ my $example = $c->req->upload('kartik-input-700[]') ;
+ my $size = $example->size;
+ my $name = $example->filename;
+ $c->render(json => {});
+hook(after_build_tx => sub {
+ $tx->res->headers->header('Access-Control-Allow-Origin' => '*');
+ $self->res->headers->header('Access-Control-Allow-Origin'=> '*');
+ $self->res->headers->header('Access-Control-Allow-Credentials' => 'true');
+ $self->res->headers->header('Access-Control-Allow-Methods' => 'GET, OPTIONS, POST, DELETE, PUT');
+ $self->res->headers->header('Access-Control-Allow-Headers' => 'Content-Type, X-CSRF-Token');
+ $self->res->headers->header('Access-Control-Max-Age' => '1728000');
+ $self->respond_to(any => { data => '', status => 200 });
+my $mode = shift(@ARGV);
+push(@ARGV, "daemon", "-l", 'http://*:3000') if "display" eq $mode;
+push(@ARGV, "daemon", "-l", 'http://*:3001') if "process" eq $mode;
+# https://github.com/kartik-v/bootstrap-fileinput#manual-install
+ <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">
+ <link href="/fileinput.min.css" media="all" rel="stylesheet" type="text/css" />
+ <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
+ <script src="/fileinput.min.js" type="text/javascript"></script>
+ <input id="input-700" name="kartik-input-700[]" type="file" multiple class="file-loading">
+ $("#input-700").fileinput({
+ uploadUrl: "http://127.0.0.1:3001/upload", // server upload action