Search the Community
Showing results for tags 'progress bar'.
-
I try to upload fale(game.swf) from another webserver to my webserver, and that is not problem. Problem is create progress bar to track copying files process, or more precisely, the calculation and display the value in percentage, of file that i currently copied from other webserver to my webserver (alredy have full size of file variable) This is what i do for now. ----------------------------------------------- after clik on install buton (div element) jq.js file $(".button").click(function () { var val = $(this).attr("id"); //id have url value for game i want to install http://www......game.swf $.post('proces.php',{val: val},function(data){ $(".final_data").html(data); }); }); proces.php file $link = $_POST['val']; // ... function remotefileSize($url) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_NOBODY, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_MAXREDIRS, 3); curl_exec($ch); $filesize = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD); curl_close($ch); if ($filesize) return $filesize; } $b = remotefileSize($igrica_mochi); $mb = $b / 1048576; echo round($mb, 2). " Mb<br>"; //round(1.95583, 2); echo $b. " bytes<br>";// ... if (@copy($game_from_other_server, $game_in_my_server) ) { echo "- Finish!<br>"; }else{ echo "- Error.<br>"; $errors= error_get_last(); echo "- COPY ERROR: ".$errors['type']; echo "<br />\n".$errors['message']; }Formula for calculating procent is progres = (current / full) * 100 And question is value of 'current' Any ideas ?