<?php if (@$_GET['id']) { } ?> <form enctype="multipart/form-data" action="aaa.php" method="POST"> <input name="img" type="file" /><br /> <input type="submit" value="Wyslij"/> <span id="uploadprogressbar" class="progressbar">0%</span> </form> <script type="text/javascript"> // this sets up the progress bar $(document).ready(function() { $("#uploadprogressbar").progressBar(); }); // fades in the progress bar and starts polling the upload progress after 1.5seconds function beginUpload() { // uses ajax to poll the uploadprogress.php page with the id // deserializes the json string, and computes the percentage (integer) // update the jQuery progress bar // sets a timer for the next poll in 750ms $("#uploadprogressbar").fadeIn(); var i = setInterval(function() { $.getJSON("aaa.php?id=" + progress_key, function(data) { if (data == null) { clearInterval(i); location.reload(true); return; } var percentage = Math.floor(100 * parseInt(data.bytes_uploaded) / parseInt(data.bytes_total)); $("#uploadprogressbar").progressBar(percentage); }); }, 1500); } </script> <?php $plik_tmp = $_FILES['img']['tmp_name']; $nazwa = $_FILES['img']['name']; $rozmiar = $_FILES['img']['size']; echo "Plik: <strong>$nazwa</strong> o rozmiarze <strong>$rozmiar bajtów</strong> został przesłany na serwer!"; } ?>
Skrypt nie działa
Czy link musi być:
$.getJSON("aaa.php?id=" + progress_key, function(data)
Prosze o pomoc
ref
ref