I'm stucked in mathematic problem. I cant figure out how to calculate the time untill upload is finish.
I know following stuff:
first i thought i would substrackt starttime from actual time to get seconds passt since start
time()-$timestampstart; // seconds?
now i know ho much seconds are passed since upload start...
then i thought i could somehow divide the uploadedchunksize with filesize to kno how often i could get this package into the file size somehow calculate it
my status fiule looks like this:
<?php
$statFilesize = 6399866206;
$statuploaded = 5662310400;
$timestampstart = 1513935180;
?>
and i include this file into my test.php where i am stuck atm
<?php
include './status2';
$timestampnow = time()-$timestampstart;
echo $timestampnow.'<br>';
$test = $statuploaded / $statFilesize;
echo $test;
?>
So hope i could explain what i am tring to do :)
Sorry for my bad english
You can do it like this in javascript
var current_speed = uploaded_size/(now - elaped_time);
var remaining size = file_size - uploaded_size;
var remaining time = remaining_size/current_speed;
Run this code inside
setInterval(function(){
},500)
to refresh the stats every 500 milisecond.