Bonjour,
Voila je rencontre un petit problème avec mon code.
J'ai fais une fonction php qui permet de suivre en temps reel le téléchargement d'un zip
<?php
$url = 'http://cabinet.laravel.com/latest_lumen.zip';
function progress($res, $totaldownload, $downloaded, $us, $ud) {
static $last;
$ind = @round($downloaded/$totaldownload*100);t
if($last < $ind) echo $ind . str_pad(' ', 4096);
flush();
$last = $ind;
}
function body($ch, $string) {
$length = strlen($string);
return $length;
}
function connect($url) {
$ch = curl_init();
$opts = array(CURLOPT_RETURNTRANSFER => false,
CURLOPT_URL => $url,
CURLOPT_NOPROGRESS => false,
CURLOPT_PROGRESSFUNCTION => 'progress',
CURLOPT_WRITEFUNCTION => 'body'
);
curl_setopt_array($ch, $opts);
curl_exec($ch);
curl_close($ch);
}
connect($url);
?>
Faire une barre de progression en jquery
<div id="progressbar" value="1 2 3 4 5 6 7 8 9 10 11 12 13 .."> en faite ma valeur en pourcent d'ajoute a chaque fois dans la valeur de ma progress bar
http://stackoverflow.com/questions/9152373/php-flushing-while-loop-data-with-ajax je pense que tu pourrais être intéressé, dans la première réponse il y a une solution à ton problème ;)
Des Lors qu'on accède à la page via le Navigateur Cela télécharge le zip sur un serveur dans le dossier