What i basically want is to force a download to a user. I want to do this with headers however instead of forcing the download, what happens is that the file.txt is printed to the screen. Heres my code that i use atm:
<?php
if (file_exists("./files/file.txt")) {
header("Content-type: application/force-download");
header('Content-Disposition: attachment; filename="file.txt"');
readfile('./files/file.txt');
}
?>
As far as im aware this should work but mayb im overlooking something? thx in advance.
edit:
it seems that it works now however, i want to print a form immediately after (got a function called printform() which echoes a form, nothing fancy) but after the download it doesnt seem to execute the function? ayone any ideas?
Edited by bleastan, 20 July 2010 - 02:33 AM.


Sign In
Create Account


Back to top









