1
Hello, I use this code to increase the progress bar:
$(function()
{
var bar = $('.bar');
var percent = $('.percent');
var status = $('#status');
var upload = $('form').ajaxForm(
{
beforeSend: function()
{
status.empty();
},
uploadProgress: function(event, position, total, percentComplete)
{
document.getElementById("progressBarCurrentFile").style.display = 'block';
var total_perc = total | 0;
var current_perc = position | 0;
document.getElementById("progbarFile").innerHTML = Math.floor((current_perc / (total_perc / 100)) * 100) / 100 + '%';
document.getElementById("progbarFile").style.width = current_perc / (total_perc / 100) + '%';
},
complete: function(xhr)
{
location.href = 'home';
}
});
});
The problem is that when the file is larger than 2GB
he starts to count negative.
Even though I put it on Pho.ini post_max_size = 9999999M
and upload_max_filesize = 9999999M
You can tell the file size before you send it, right? When you finish climbing, does it give the correct size or does it enter this negative number? I mean, the final size gets smaller than the original?
– Daniel
@Daniel Yes, he arrives without any loss.
– Lucas Caresia
So don’t just consider this negative number as 0? Then you make proportional to 100% with the file size, it gives in the same.
– Daniel
@Daniel No, why does it get to -340 times%.
– Lucas Caresia
So take the first amount you want to get to
current_perc
and uses it as a minimum value. You can even reduce this total value in your account in all other operations.(current_perc / ((total_perc - minimal_perc) / 100)) * 100) / 100 + '%'
, drew?– Daniel