在IE9中下载缓冲区 [英] Download Buffer in IE9

查看:86
本文介绍了在IE9中下载缓冲区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新手,我一直面临着IE9上的特殊问题。

我一直试图找到互联网设备的最大下载和上传速度。因此,我正在下载数据缓冲区并将数据缓冲区上传到服务器。

在IE8中,以下代码工作正常



< pre lang =cs> if (BrowserType == MSIE
{
xhr = new XDomainRequest();
xhr.onerror = err;
xhr.ontimeout = timeo;
xhr.onprogress = progres;
xhr.onload = loadd;

xhr.timeout = 500 ;
}
else
xhr = new window.XMLHttpRequest() ;
xhr.onreadystatechange = function()
{
var iLen = bufferedData.length;
if (iLen < = 100000
bufferedData = bufferedData + xhr.responseText;

}

xhr.open( GET myserverfile.php true );
xhr.send();



我正在向服务器发送一个Ajax请求,并从服务器下载一些文件流,如下所示:







 define('   CHUNK_SIZE',1024 * 15240);  //   tile块的大小(以字节为单位) 

function readfile_chunked($ filename){

echo 在ReadFile中;

$ buffer = ' ';

$ cnt = 0;

$ handle = fopen($ filename,' rb');

if ($ handle === false){

返回 false;

}

while ($ cnt!= 1){

$ buffer = fread($ handle,CHUNK_SIZE);

echo $ buffer ;

ob_flush();

flush();

++ $ cnt;

sleep(1);
}
$ status = fclose($ handle);

return $ status ;
}
$ filename = argo.MP4;
// echoBefore Readfile;
readfile_chunked($ filename);







我面临的问题是,当我在IE8中将CHUNK_SIZE作为1024 * 15240时,即它说X时间下载1024 * 15240数据,它工作正常但是当我给出相同的'CHUNK_SIZE'时,1024 * 15240);在IE9中,它不会下载整个数据而且会卡在中间。

是因为IE8和IE9中的缓冲区大小差异还是我的代码存在问题。据我说,我不认为有任何问题,但仍然。



请建议我可以通过IE9向前推进。

谢谢

解决方案

filename){

echo 在ReadFile中;


buffer = ' ';


cnt = 0;


Im a novice and i have been facing issues specially on IE9.
I ve been trying to find the max download and upload speed for a internet device. So for it i am downloading a data buffer and uploading a data buffer to a server.
In IE8 the following code works fine

if(BrowserType=="MSIE")
    {
      xhr=new XDomainRequest();
      xhr.onerror = err;
      xhr.ontimeout = timeo;
      xhr.onprogress = progres;
      xhr.onload = loadd;
   
      xhr.timeout = 500;
    }
    else
        xhr = new window.XMLHttpRequest();
    xhr.onreadystatechange=function()
    {
        var iLen = bufferedData.length;
        if(iLen <= 100000)
          bufferedData=bufferedData+xhr.responseText;
     
    }

    xhr.open("GET", "myserverfile.php", true);
    xhr.send();


I am sending a Ajax request to the server and downloading bit of stream of file from the server as follows:



define('CHUNK_SIZE', 1024*15240); // Size (in bytes) of tiles chunk

function readfile_chunked($filename) {

echo "In ReadFile";

    $buffer='';

    $cnt=0;

    $handle=fopen($filename, 'rb');

    if ($handle===false) {

      return false;

    }

    while ($cnt!=1) {

      $buffer=fread($handle, CHUNK_SIZE);

      echo $buffer;

      ob_flush();

      flush();

      ++$cnt;

      sleep(1);
    }
   $status=fclose($handle);

    return $status;
   }
  $filename="argo.MP4";
  //echo "Before Readfile";
  readfile_chunked($filename);




The problem that i am facing is that when i give CHUNK_SIZE as 1024*15240 in IE8 i.e it downloads 1024*15240 data in say X time, it works fine but when i give the same 'CHUNK_SIZE', 1024*15240); in IE9, it doesnt download the whole data and gets stuck in the middle.
Is it because of the buffer size difference in IE8 and IE9 or is there some problem with my code. According to me i dont think there is any problem but still.

Please suggest me something through which i can move forward with IE9.
Thank you

解决方案

filename) { echo "In ReadFile";


buffer='';


cnt=0;


这篇关于在IE9中下载缓冲区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆