Speed and ETA
Display real-time upload speed (KB/s or MB/s) and estimated time remaining for each file.
What you should see: live transfer speed and a time-remaining estimate per file, both derived from progress events. Throttle your connection to watch the estimate adjust. Cap is 100 MB.
Ready
<div id="my-uploader"></div>
<span id="speed"></span>
<span id="eta"></span>
<script>
var startTime, startLoaded;
CoreUpload.create('#my-uploader', {
uploadUrl: '/api/upload/upload',
autoUpload: true,
maxFileSize: '100MB',
// The engine maintains task.speed (bytes/sec, smoothed) and task.eta
// (seconds) for you - no need to time the transfer by hand.
onTaskProgress: function(task) {
var speedText = task.speed > 1048576
? (task.speed / 1048576).toFixed(1) + ' MB/s'
: (task.speed / 1024).toFixed(0) + ' KB/s';
var etaText = task.eta < 60
? Math.ceil(task.eta) + 's remaining'
: Math.ceil(task.eta / 60) + 'm remaining';
document.getElementById('speed').textContent = speedText;
document.getElementById('eta').textContent = etaText;
},
onTaskComplete: function(task) {
document.getElementById('speed').textContent = 'Done';
document.getElementById('eta').textContent = '';
}
});
</script>