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);
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";
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