<?php
header("Cache-Control: no-cache, must-revalidate"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
if (@$_GET['id']) {
echo json_encode
(uploadprogress_get_info
($_GET['uuid'])); }
?>
<form enctype="multipart/form-data" action="aaa.php" method="POST">
<input name="img" type="file" /><br />
<input id="progress_key" name="UPLOAD_IDENTIFIER" type="hidden" value="
<?php echo $uuid; ?>" />
<input type="submit" value="Wyslij"/>
<span id="uploadprogressbar" class="progressbar">0%</span>
</form>
<script type="text/javascript">
var progress_key = '
<?php echo $uuid; ?>';
// 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