내가 파일 다운로드에 CodeIgniter의에 문제가 있어요 다운로드하지만 난 CodeIgniter의에서 코드를 넣을 때 파일이 성공적으로 다운로드됩니다, .하지만 손상 :(PHP - CodeIgniter는이 코드는 단독으로 PHP 파일에 완벽하게 작동</p> <p>.. 원격 파일
참고했다 : 나는 원격 서버에서 비디오 파일을 함께 일하고 있어요
코드 :.
$file = fopen ($link, "r");
if (!$file) {
echo "<p align='center' style='color:#FF0101;'>Unable to open remote file :(, Please try again in a few minutes.</p>";
}else{
ob_clean();
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header('Content-Disposition: attachment; filename=zxc.3gp');
//header("Content-Transfer-Encoding: binary");
//header("Content-Length: ".$video_size);
while (!feof ($file)) {
$line = fgets ($file, 1024);
echo $line;
ob_flush();
flush();
}
fclose($file);
die();
}
나는 새로운 CodeIgniter의 프로젝트에서이 코드를 시도 :
public function index()
{
$link = 'http://mamprogr.net.tc/tmp/1.3gp';
$this->load->helper('download');
force_download('1.3gp',$link);
}
하지만 도움이된다면 :(
무엇이 질문입니까? 무슨 일 이니? 오류 메시지가 있습니까? [당신은 무엇을 했습니까?] (http://www.whathaveyoutried.com) – orourkek
CodeIgniter [출력 클래스] (http://codeigniter.com/user_guide/libraries/output.html)! <- 해당 페이지를 참조하십시오. 어떻게 문제를 해결할 수 있을지 모르지만 문제는 _ 문제입니다. – Prasanth
출력을 gzip으로 압축하고 있습니까? 그렇다면 문제가됩니다. gzip 압축이 활성화 된 경우 컨트롤러 메서드에서 직접 내용을 출력 할 수 없습니다. 보기를 사용해야합니다. – Brendan