说明:部分函数是外部的,本程序的FTP是基于ZF写的,没提供,

运行是load.php?P=show,任何直接访问都没用

发上来只是供大家参考.

原理:
sent边发文件边写文件(随机创建一个),完了后删除文件.

原本是用session的,结果老是不对头,就用的这种方式.有意的可下到自己电脑上去看看.

直接运行是运行不起的,因为差文件.不是我不提供文件,我发上来只是供大家参考.

show.php->修正了的 把下面的代码替换show.php 主要修改了JS,变的更简单了


  1FTP发送文件进度条<?php    
  2FTP发送文件进度条session_start();    
  3FTP发送文件进度条if(!defined('BASE_URL'))die('Hacking Attmpt!');    
  4FTP发送文件进度条$writescriptfile = BASE_URL.'bizman'.'.html';    
  5FTP发送文件进度条//@unlink($writescriptfile);    
  6FTP发送文件进度条$fileall = 'http://192.168.1.7/bizman.php';    
  7FTP发送文件进度条/**DELETE 要用*/   
  8FTP发送文件进度条$_SESSION['args_delete'= '1';    
  9FTP发送文件进度条$width = 652;    
 10FTP发送文件进度条   header('Cache-Control: no-store, no-cache, must-revalidate');    // HTTP/1.1     
 11FTP发送文件进度条   header('Cache-Control: pre-check=0, post-check=0, max-age=0');    // HTTP/1.1    
 12FTP发送文件进度条   header ("Pragma: no-cache");    
 13FTP发送文件进度条   header("Expires: 0");    
 14FTP发送文件进度条?>    
 15FTP发送文件进度条<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"   
 16FTP发送文件进度条    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">    
 17FTP发送文件进度条<html xmlns="http://www.w3.org/1999/xhtml">    
 18FTP发送文件进度条    <head>    
 19FTP发送文件进度条        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    
 20FTP发送文件进度条        <title>Sent file to server</title>    
 21FTP发送文件进度条        <script type="text/javascript" src="http://192.168.1.7/js/jquery.js"></script>    
 22FTP发送文件进度条        <script type="text/javascript">    
 23FTP发送文件进度条  $(document).ready(function(){    
 24FTP发送文件进度条            getpage();    
 25FTP发送文件进度条            doProgress();    
 26FTP发送文件进度条            //$("#show").load("http://192.168.1.7/bizman.php");     
 27FTP发送文件进度条            });    
 28FTP发送文件进度条  function getpage(){    
 29FTP发送文件进度条                $.get("http://192.168.1.7/load.php?p=sent");    
 30FTP发送文件进度条            }    
 31FTP发送文件进度条   
 32FTP发送文件进度条         var i = 0;    
 33FTP发送文件进度条  function doProgress() {    
 34FTP发送文件进度条                if (i > 10) {    
 35FTP发送文件进度条                    alert("sent data is ok");    
 36FTP发送文件进度条                    return;    
 37FTP发送文件进度条                }    
 38FTP发送文件进度条                if (i <= 10) {    
 39FTP发送文件进度条                    stetimes = setTimeout("doProgress()", 300);    
 40FTP发送文件进度条                    showinfo(i);    
 41FTP发送文件进度条                    i++;    
 42FTP发送文件进度条                }    
 43FTP发送文件进度条            }    
 44FTP发送文件进度条  function showinfo(Progress){    
 45FTP发送文件进度条                if (Progress) {    
 46FTP发送文件进度条                    var html = $.trim($.ajax({    
 47FTP发送文件进度条                                url: "http://192.168.1.7/bizman.php",    
 48FTP发送文件进度条                                cache:false,    
 49FTP发送文件进度条                                async: false//防止出现完成该操作所需的数据还不可使用    
 50FTP发送文件进度条                                }).responseText);    
 51FTP发送文件进度条                        switch(html){    
 52FTP发送文件进度条                            case "unlogin" :    
 53FTP发送文件进度条                        clearTimeout(stetimes);    
 54FTP发送文件进度条                        $("#show").html('<script language="JavaScript">updateProgress("Can Not Login in Ftp Server.Please Check pass or user", 10 );<\/script>');    
 55FTP发送文件进度条                        $.get("/load.php?p=delete");    
 56FTP发送文件进度条                            break;    
 57FTP发送文件进度条                            case "error" :    
 58FTP发送文件进度条                        clearTimeout(stetimes);    
 59FTP发送文件进度条                        $("#show").html('<script language="JavaScript">updateProgress("Can Not Connet Ftp Server.", 10);<\/script>');    
 60FTP发送文件进度条                        $.get("/load.php?p=delete");    
 61FTP发送文件进度条                            break;    
 62FTP发送文件进度条                            break;    
 63FTP发送文件进度条                            case "sentok" :    
 64FTP发送文件进度条                        clearTimeout(stetimes);    
 65FTP发送文件进度条$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>');    
 66FTP发送文件进度条$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>');    
 67FTP发送文件进度条$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>');    
 68FTP发送文件进度条$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>');    
 69FTP发送文件进度条$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>');    
 70FTP发送文件进度条$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>');    
 71FTP发送文件进度条$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>');    
 72FTP发送文件进度条$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>');    
 73FTP发送文件进度条$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>');    
 74FTP发送文件进度条$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>');    
 75FTP发送文件进度条$("#show").html('<script language="JavaScript">updateProgress("Finished sent all the files.", <?php echo $width; ?> );<\/script>');    
 76FTP发送文件进度条        showUrl()    
 77FTP发送文件进度条                        $.get("/load.php?p=delete");    
 78FTP发送文件进度条                        break;    
 79FTP发送文件进度条                        default:    
 80FTP发送文件进度条    $("#show").html(html);    
 81FTP发送文件进度条// 注意这一句,过去不是这样的,不信可以对比一下两个文件    
 82FTP发送文件进度条                //$("#show").load("http://192.168.1.7/bizman.php");    
 83FTP发送文件进度条                //alert('我靠你老篾青的');    
 84FTP发送文件进度条                        }    
 85FTP发送文件进度条                }    
 86FTP发送文件进度条            }    
 87FTP发送文件进度条    function updateProgress(sMsg, iWidth)    
 88FTP发送文件进度条   {     
 89FTP发送文件进度条       document.getElementById("status").innerHTML = sMsg;    
 90FTP发送文件进度条       document.getElementById("progress").style.width = iWidth + "px";    
 91FTP发送文件进度条       document.getElementById("percent").innerHTML = parseInt(iWidth / <?php echo $width?> * 100+ "%";    
 92FTP发送文件进度条    }    
 93FTP发送文件进度条    function showUrl(){    
 94FTP发送文件进度条        $("#show").append('<div style="position:absolute; top:55px; left:250px; text-decoration:none;"><a href="<?php echo $url ?>" target="_blank"><span style="color:red;font-size:15px; font-weight:bold;">Please click here go to vist you website!</span></a></div>');    
 95FTP发送文件进度条    }    
 96FTP发送文件进度条       </script>      
 97FTP发送文件进度条</head>    
 98FTP发送文件进度条<body>    
 99FTP发送文件进度条<div style="margin:4px 4px 0px 20px;  padding: 8px; color:#FF0000; font-size:13px; font-weight:bold;border: 1px solid gray; margin-left:14px;background: #EAEAEA; width: <?php echo $width+8; ?>px">    
100FTP发送文件进度条   <div style="text-align:center"><font color="#FF0000">发送文件中FTP发送文件进度条</font></div>    
101FTP发送文件进度条   <div style="padding: 0; background-color: white; border: 1px solid navy; width: <?php echo $width; ?>px">    
102FTP发送文件进度条       <div id="progress" style="padding: 0; background-color: #FFCC66; border: 0; width: 0px; text-align: center;  height: 16px"></div>                
103FTP发送文件进度条   </div>    
104FTP发送文件进度条   <div id="status"> </div>    
105FTP发送文件进度条   <div id="percent" style="position: relative; top: -30px; text-align: center; font-weight: bold; font-size: 8pt">0%</div>    
106FTP发送文件进度条</div>    
107FTP发送文件进度条<div id ="show"></div>    
108FTP发送文件进度条</body>    
109FTP发送文件进度条</html>    
110FTP发送文件进度条   
111FTP发送文件进度条

附件: processbar.zip

相关文章:

  • 2021-10-17
  • 2021-12-23
  • 2022-02-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
猜你喜欢
  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-04
  • 2021-12-19
  • 2021-12-03
相关资源
相似解决方案