marhoons Posted January 5, 2008 Share Posted January 5, 2008 Hi every body, when I have a media file grater than 5.44 MB I missing some byte in download with header function I don't know what exactly problem, so look at my code and any commants please? <? include("connect/config.php"); $id= intval($_REQUEST["id"]); $sql1= mysql_query("select * from $tsound where id='$id' ") or die("Error1"); $row1= mysql_fetch_array($sql1); $sql2= mysql_query("select * from $tsound2 where id='$row1[mtype]' ") or die("Error2"); $row2= mysql_fetch_array($sql2); $file= "media/$row2[mkdirs]/$row1[mpath]"; $len = filesize($file); $filename = basename($file); $stype = strtolower(substr(strrchr($filename,"."),1)); if ($stype=="mp3") { $ctype="audio/mpeg"; } else if ($stype=="wmv") { $ctype="video/x-ms-wmv"; } else { $ctype="audio/x-ms-wma";} header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Type: $ctype"); $header="Content-Disposition: attachment; filename=".$row1[mtitle].";"; header($header); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".$len); @readfile($file); exit(print"<script>self.close(); <script>"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/84643-missing-some-byte-with-hedaer-download-function/ Share on other sites More sharing options...
marhoons Posted January 15, 2008 Author Share Posted January 15, 2008 no reply.... Quote Link to comment https://forums.phpfreaks.com/topic/84643-missing-some-byte-with-hedaer-download-function/#findComment-439823 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.