fsshos 2013-07-06 00:38:49
fopen() 함수로 작은용량은 다운로더가 되는데 큰용량은 다운로더가 되지 않네요.

아래 소스코드는 제가 만든 소스코드 인데 작은용량(30MB) 까지는 문제없이 다운로더가 되는데 36MB쯤 되는 zip 압축파일을 다운로더로더 하니 고작 파일크기가 219바이트만 전송이 되네요.
즉, 파일명만 전송이 되고 파일내용은 없는것 같네요.

혹시 php.ini 나 아파치 서버에서 용량 제한이 걸려 있나요?

답변 좀 부탁드립니다.

- 소스코드 -
==================================================================

function file_download_now($file_path , $file_name){

   global $HTTP_USER_AGENT;

  if($file_name && file_exists($file_path)){

      if(eregi("(Chrome|Safari|MSIE 5.5|MSIE 6.0|MSIE 7.0|MSIE 8.0|MSIE 9.0|MSIE 10.0|MSIE 11.0|MSIE 12.0)",$HTTP_USER_AGENT)){
        Header("Content-type: application/octet-stream");  
         Header("Content-Length: ".(string)(filesize($file_path))); //다운로드 게이지를 나타냅니다.
         Header("Content-Disposition: attachment; filename=$file_name"); //파일을 무조건 다운로드 합니다.
         Header("Content-Transfer-Encoding: binary");
         Header("Pragma: no-cache");  
         Header("Cache-Control: cache, must-revalidate"); //다운로드 확인창에서 다운로드 하지 않고 바로 열 수 있습니다.
         Header("Expires: 0");    

      } else {  

         Header("Content-type: file/unknown");      
         Header("Content-Length: ".filesize($file_path));  
         Header("Content-Disposition: attachment; filename=$file_name");  
         Header("Content-Description: PHP3 Generated Data");  
         Header("Pragma: no-cache");  
         Header("Cache-Control: cache, must-revalidate");  
         Header("Expires: 0");  
      }

      $fp = fopen($file_path, "rb");  
      while(!feof($fp)) {  
          echo fread($fp, filesize($file_path));  
          flush();  
      }  
      fclose ($fp);  
     exit;

   }
   else{
        echo "<script> alert('error.  file download faild.');\n" ;
        echo "</script>\n" ;
        echo "Failed. Sorry! your download is failed. <br><br>So please note download link at side page. Next try again by download link.";

   }
} // end function