if the URI query string is ?progress_id=<id> intercept the request
# and display the progress JSON.
my $query = $c->req->uri->path_query;
if ( $c->req->method eq 'GET' && $query =~ m{\?pro
};
}
# format the progress data as JSON
my $json = '{"size":%d,"received":%d,"aborted":%d}';
my $output = sprintf $json,
$progress->{size},
$progress->{rec
no-cache, must-revalidate, post-check=0, pre-check=0' );
$c->response->content_type( 'text/x-json' );
$c->response->body( $output );
}
sub upload_progress_javascript {
my $c = shift;
ans that text/html gets picked first
req.setRequestHeader(
'Accept',
'text/x-json; q=1.1'
);
req.onreadystatechange = function() {
if (req.readyState == 4)
);
};
req.send(null);
}
function handleUploadProgressResults(results) {
var state = JSON.parse(results);
if ( state != undefined ) {
state.starttime = progress.startt
data = data();
else if (typeof data == 'string') {
Ajax.get(data, function(r) { proc(JSON.parse(r)) });
return;
}
return proc(data);
}
//--------------------------------