8
« on: December 12, 2005, 06:00:33 PM »
after researching i find out that the problem is start with this code inside download.php witch download by buffering witch will not serve me with files more that 200 M,
function get_file_data($file_path) {
global $script_url;
ob_start();
@ob_implicit_flush(0);
@readfile($file_path);
$file_data = ob_get_contents();
ob_end_clean();
if (!empty($file_data)) {
return $file_data;
}
elseif (is_remote_file($file_path)) {
$file_data = get_remote_file($file_path);
}
else {
if (!file_exists($file_path)) {
$file_path = preg_replace("/\/{2,}/", "/", get_document_root()."/".$file_path);
}
if (file_exists($file_path)) {
$file_size = @filesize($file_path);
$fp = @fopen($file_path, "rb");
if ($fp) {
$file_data = @fread($fp, $file_size);
@fclose($fp);
}
}
}
if (empty($file_data)) {
if (ereg("^\/", $file_path)) {
preg_match("/^(http:\/\/[^\/]+)/i", $script_url, $regs);
$script_url = $regs[1];
}
$file_data = get_remote_file($script_url."/".$file_path);
}
return (!empty($file_data)) ? $file_data : 0;
}
so i start a thread on webhostingtalk asking for new code witch may serve me and we finally agrae that the best way is by this code
$handle = fopen("http://www.example.com/", "rb");
$contents = '';
while (!feof($handle)) {
$contents .= fread($handle, 8192);
// do something else
}
fclose($handle);
i tried to use it on the funcation but i didnt get it right
so can any one help me with it please ?