브라우저가 파일을 열지 않고 '다운로드'하도록 강제 설정하는 방법이 있습니까?Javascript JQuery 링크를 사용하여 txt 파일을 다운로드하십시오.
<a href="file.txt">Download this file</a>
js를 통해 window.open ("file.txt", "Download");
하지만 성공하지 못했습니다.
Thx.
업데이트 : 나는 다음과 같은 PHP 파일을 한 적이
;
<html>
<a href='dl.php?bid=3'>
<php>
$sql="select barquivo from bibilioteca where bid=$_GET[bid]";
$row=mysql_fetch_assoc(mysql_query($sql));
header("Content-Disposition: attachment;filename=biblioteca/$row[barquivo]");
그리고 "biblioteca_"파일을 0 바이트로 다운로드합니다.
최고 답변은이 링크에 있습니다. http://stackoverflow.com/questions/1597732/php-force-file-download-and-ie-yet-again/1597946#1597946 –