2009-09-24 5 views
0

웹 기반 파일 관리자를 쓰고 있습니다. html 파일을 표시하는 대신 해당 링크를 클릭하면 어떻게 다운로드 할 수 있습니까? 당신이 할 것 PHP에서 examle를 들어대신에 html 파일이 다운로드 됨

Content-Disposition: attachment; filename="document.html" 

: 파일을 제공 할 때

서버 측에

답변

6

,이 헤더를 추가

header('Content-Disposition: attachment; filename="document.html"'); 
-1

는 당신의 HTTP 응답에 Content-Type 헤더를 설정 'application/octet-stream'.

는 ASP.net/C#

Response.ContentType = "application/octet-stream"; 
-1

에서 서버는 해당 파일은 응용 프로그램/octet-stream을 같이 요청 다른 MIME 타입을 반환해야합니다.

0

응답 헤더에서 Content-Disposition을 "attachment; filename = something.html"로 설정하십시오.

관련 문제