2010-04-12 3 views
0

MySql 테이블의 blob 필드에 파일 (모든 유형)을 업로드합니다. 이제 필자는 해당 필드에서 바이너리 데이터를 가져올 수 있으며 프린트 할 때 바이너리 데이터를 firbug 콘솔에 표시합니다. 그러나 업로드 된 파일을 다운로드하고 싶습니다.젠드 프레임 워크 : mySQL Blob 필드에서 파일을 다운로드하는 방법

이 바이너리 데이터를 어떻게 orignal 파일로 변환 할 수 있습니까? 어떻게 젠드에서 그것을 할 수 있습니까?

감사

답변

2

당신은

<?php 
header("Content-Type: application/octet-stream"); 
header("Content-Disposition: attachment; filename=\"".$filename."\";"); 
echo $data; 
exit; 
?> 

또는 preferablly

<?php 
header("Pragma: public"); 
     header("Expires: 0"); 
     header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 
     header("Cache-Control: private",false); 
     header ("Content-Type: $filedatatype"); 
     header("Content-Disposition: attachment; filename=\"".$FileObj->name."\";"); 
     header("Content-Transfer-Encoding:­ binary"); 
     header("Content-Length: ".$filesize); 
echo $data; 
exit; 
?> 
필요 최소한 헤더를 설정해야