Login   Register  
PHP Classes
elePHPant
Icontem

Changes to work with IE8

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      Bf_Download  >  All threads  >  Changes to work with IE8  >  (Un) Subscribe thread alerts  
Subject:Changes to work with IE8
Summary:I have changed some code to work in IE8
Messages:2
Author:Juan Antonio
Date:2010-02-11 09:44:53
Update:2010-02-11 09:49:05
 

  1. Changes to work with IE8   Reply   Report abuse  
Picture of Juan Antonio
Juan Antonio
2010-02-11 09:44:53
Hello:

I have tested this and it don't work with IExplorer 8. I don't know why? But, how i don't need resume mode, i have changed some lines to another code for 'not resume downloads' and now it's works fine.

They are my changes:

In the method file_download:

if($this->properties["resume"] || $this->properties["max_speed"]>0)
{
header("Content-Range: $download_range"); // download range
// send the file content
$fp=fopen($this->properties["path"],"r"); // open the file
fseek($fp,$byte_from); // seek to start of missing part
while(!feof($fp)){ // start buffered download
set_time_limit(0); // reset time limit for big files (has no effect if php is executed in safe mode)
print(fread($fp,1024*8)); // send 8ko
flush();
usleep($sleep_time); // sleep (for speed limitation)
}
fclose($fp); // close the file
}
else
readfile($this->properties["path"]);

exit;

  2. Re: Changes to work with IE8   Reply   Report abuse  
Picture of Juan Antonio
Juan Antonio
2010-02-11 09:49:05 - In reply to message 1 from Juan Antonio
I have added also some content_types and modified $name because for my don't work.

public function __construct($path, $name=null, $resume=null, $max_speed=0)
{
if(empty($name)) $name=basename($path); // $name=substr(strrchr("/".$path,"/"),1);
if($resume===null) $resume=false;

$file_extension = strtolower(substr(strrchr($path,"."),1)); // the file extension
switch($file_extension) { // the file type
case "mp3": $content_type="audio/mpeg"; break;
case "mpg": $content_type="video/mpeg"; break;
case "avi": $content_type="video/x-msvideo"; break;
case "wmv": $content_type="video/x-ms-wmv";break;
case "wma": $content_type="audio/x-ms-wma";break;
case "pdf": $content_type="application/pdf";break;
case "zip": $content_type="application/zip";break;
case "doc": $content_type="application/msword";break;
case "xls": $content_type="application/vnd.ms-excel";break;
case "ppt": $content_type="application/vnd.ms-powerpoint";break;
case "gif": $content_type="image/gif";break;
case "png": $content_type="image/png";break;
case "jpe":
case "jpeg":
case "jpg":
$content_type="image/jpg";break;
case "exe": $content_type="application/octetstream"; break; //($browser=='IE' || $browser=='OPERA')?($ctype="application/octetstream"):($ctype="application/octet-stream"));
default: $content_type="application/force-download";
}
$file_size = filesize($path); // the file size
$this->properties = array(
"path" => $path,
"name" => $name,
"extension" =>$file_extension,
"type"=>$content_type,
"size" => $file_size,
"resume" => $resume,
"max_speed" => $max_speed
);
}