php returning file corrupt on mp4 readfile access to folder outside root directory -
am trying load mp4 file on page corrupt file message.
am using php file load private folder outside root directory , open directly browser see if video plays directly firefox browser:
if(!empty($_get['video'])) { if (strpos($_get['video'], "\0") !== false) die(''); $video = $_request['video']; $path_parts = pathinfo($video); $file_name = $path_parts['basename']; require_once("config.php"); if(isuserloggedin()) { //construct order object $ispaid = new order($reference=$loggedinuser -> user_id,$pesapal_tracking_id=null,$orderstatus = null); //check if paid if($ispaid->ispaid()) { //private folder $file = $_server['document_root'].'/../privatelogged/'. $file_name; header("expires: mon, 26 jul 1997 05:00:00 gmt"); header("cache-control: no-store, must-revalidate"); header("content-type: video/mp4"); header('content-length: ' . filesize($file)); set_time_limit(0); $resource = @fopen($file,"rb"); while(!feof($resource)) { print(@fread($resource, 1024*8)); ob_flush(); flush(); } //readfile($file); } }
}
Comments
Post a Comment