Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //We don't want to be caching this, right? =)
- header('Expires: Tue, 08 Oct 1991 00:00:00 GMT');
- header('Cache-Control: no-cache, must-revalidate');
- $url = basename($_SERVER['SCRIPT_FILENAME']);
- if ($_GET["progress_key"])
- {
- echo "GET success!";
- $status = apc_fetch('upload_'.$_GET['progress_key']);
- var_dump($status);
- die;
- }
- else
- ?>
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.js" type="text/javascript"></script>
- <script>
- $(document).ready(function() {
- setInterval(function() {
- $.get(
- "<?php echo $url; ?>?progress_key=<?php echo $_GET['uid']; ?>&randval="+ Math.random(),
- {
- // Get request to the current URL (upload_frame.php) which calls the code at the top of
- // the page. It checks the file's progress based on the file id "progress_key=" and
- // returns the value with the function below:
- },
- function(data) { //return information back from jQuery's get request
- console.log("Data: " + data);
- $('#progress_container').fadeIn(100); // Fade in progress bar
- $('#progress_bar').width(data +"%"); // Set width of progress bar
- // based on the $status value (set at the top of this page)
- $('#progress_completed').html(parseInt(data) +"%"); // Display the % completed
- // within the progress bar
- }
- )
- }, 500); //Interval is set at 500 milliseconds (the progress bar will refresh every .5 seconds)
- });
- </script>
- <body>
- <div>TEST</div>
- <?php
- if (isset($_GET["uid"]))
- {
- echo "UID: ".$_GET["uid"];
- }
- ?>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement