$value) $params[$key] = $value; /* call the callback function and await the result */ $fileResult = call_user_func($callback, $params); /* if everything is ok, then proceed with the download of the file */ if (!is_null($fileResult)) { if (isset($fileResult['filename']) && isset($fileResult['content'])) { if (ereg('Opera(/| )([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT'])) $UserBrowser = "Opera"; elseif (ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT'])) $UserBrowser = "IE"; else $UserBrowser = ''; $mime_type = ($UserBrowser == 'IE' || $UserBrowser == 'Opera') ? 'application/octetstream' : 'application/octet-stream'; header("Pragma: public"); header("Cache-Control: cache, must-revalidate"); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=\"" . $fileResult['filename'] . "\""); header('Pragma: no-cache'); header("Expires: 0"); header("Content-length: " . strlen($fileResult['content'])); echo $fileResult['content']; die(); } } else die(); } } ?>