| 제목 | 대용량 파일 다운로드 질문. | ||
|---|---|---|---|
| 글쓴이 | 유승민 | 작성시각 | 2013/06/13 09:43:41 | 
|  | |||
| $folder = $this->input->post('folder', true);   $this->load->helper('download');   $data = file_get_contents("./static/img/zip/".$folder.".zip"); // Read the file's contents   $name = $folder.'.zip';   force_download($name, $data); 위와 같은 방식으로 다운로드를 실행하고 있습니다. 용량이 적은 파일의 경우 아주 잘 실행이 되구요... 다운로드도 아주 잘 됩니다. 용량이 큰 파일을 다운로드 받으려고 하면 Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 534317467 bytes) in /home/iwop/public_html/app/controllers/photoGallery.php on line 49 위와 같은 에러가 발생합니다. 49번째 라인이면 $data = file_get_contents("./static/img/zip/".$folder.".zip"); // Read the file's contents 이부분이네요.. 보통 zip파일을 a태그로 링크걸면 다운로드 되잖아요.. 그 방법을 써볼까도 생각했는데... 프레임워크 구동방식... staitc이라는 컨트롤러... 끆.. 뭔가 방법이 없을까요? (서버 메모리를 키운다던가 이런거 말고.. 소스만 수정해서..) | |||
| 다음글 | ajax질문이요~ (4) | ||
| 이전글 | 파일 업로더 질문이요 (2) | ||
| 
                                한대승(불의회상)
                                /
                                2013/06/13 09:58:29 /
                                추천
                                0
                             | 
| 
                                유승민
                                /
                                2013/06/13 10:37:01 /
                                추천
                                0
                             
                                 $ToProtectedFile='./static/img/zip/'.$folder.'.zip';   $data = file_get_contents($ToProtectedFile);   $handle = @fopen($ToProtectedFile, "rb");   @header("Cache-Control: no-cache, must-revalidate");    @header("Pragma: no-cache"); //keeps ie happy   @header("Content-Disposition: attachment; filename= ".$folder.'.zip');   @header("Content-Type: application/x-zip");    @header("Content-Length: ".strlen($data));   @header('Content-Transfer-Encoding: binary');   @header('Expires:0');   ob_end_clean();//required here or large files will not work   @fpassthru($handle);//works fine now 위와같이 수정을 했는데도 안되네요 ㅠ | 
| 
                                한대승(불의회상)
                                /
                                2013/06/13 11:07:43 /
                                추천
                                0
                             
                                $data = file_get_contents($ToProtectedFile); 안지우면 말짱 도루묵 | 
| 
                                유승민
                                /
                                2013/06/13 11:15:13 /
                                추천
                                0
                             
                                 엌 감사합니다! 해결됬어요 ㅜㅎㅎㅎㅎㅎ | 
http://php.net/manual/en/function.fpassthru.php
위 URL을 참고 하시면 해결 될 것 같습니다.