I have problem using APC progress bar I follow from this example
http://www.johnboy.com/php-upload-progress-bar/
I modified the code and it works. The problem is it will display the last percentages after I refresh the page. Let say a file is just finish uploaded at 100%, it will display 100% after I refresh the page. If I cancel halfway when the file being uploaded, say at 15%, 15% will stick on the progress bar until I upload another file.
Here is potion of my codes:
if(isset($_GET['progress_key'])) {
$upload = apc_fetch('upload_1234'.$_POST['APC_UPLOAD_PROGRESS']);
if ($upload) {
if ($upload['done']) {
echo $percent = 100;
}
else if ($upload['total'] == 0) {
echo $percent = 0;
}
else {
echo $percent = $upload['current'] / $upload['total'] * 100;
}
}
die;
}
Thank you in advance.