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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -