P3t3r Posted February 5, 2009 Share Posted February 5, 2009 Hi, I have a rather large string (say 150kb), and I'm using header('Content-Disposition: attachment; filename="pen.tex"'); die($mystring); to make the user download it as a file. The only disadvantage is that the whole text gets displayed. Is there a way to workaround this? I.e. not using die() or echo() probably? I know it's possible with readfile(), but that's not an option as the script has no write access to the file system, so it cannot generate a file. thanks! Peter Link to comment https://forums.phpfreaks.com/topic/143942-solved-outputting-download-without-screen-output/ Share on other sites More sharing options...
flyhoney Posted February 5, 2009 Share Posted February 5, 2009 Have you tried the example here: http://us2.php.net/readfile with die() instead of readfile() ? Link to comment https://forums.phpfreaks.com/topic/143942-solved-outputting-download-without-screen-output/#findComment-755333 Share on other sites More sharing options...
P3t3r Posted February 6, 2009 Author Share Posted February 6, 2009 header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="pen.tex"'); die($string); Works like a charm, thanks! Link to comment https://forums.phpfreaks.com/topic/143942-solved-outputting-download-without-screen-output/#findComment-755560 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.