javascript - download file in a specific folder -
i have link allows me downlowd text file in web page problem want user able chose save file mean when clicks link window should opened can save file wherever likes can 1 tell me how that? thx . here part of code:
$fichierres=fopen('res.txt','a'); ftruncate($fichierres,0); ... fputs($fichierres, $t."\r\n"); ... fclose($fichierres); echo' <div style="text-align:center"><br> <button id="download" width="100px" class="styled-button-8"><a href="res.txt" download="res.txt" style="color: #ffffff"><b>download</b></a></button></div><br>';
most browsers auto-open file can read - how should work. includes .txt files, there's nothing can prevent this.
what can provide link anchor (<a href="/myfile.txt">download</a>
) , provide message next link telling user "right click / save link as..." download - allow them save file rather download.
the exact option in right click menu differ between browsers it's along lines of "save link as...".
Comments
Post a Comment