Hi
I am thinking about following scenario.
I have a internal MySQL based news and message system for a member based site. Everything works fine. Now I want to offer the option to save a message as text file to the members hard disk.
How can I save a text file to disk that is created on the fly with the message data?
I hope you can point me to the right direction as I am not quit sure what to search for and therefore lacking the search terms to google for a solution.
[solved]on-the-fly Text file -> save to Hardisk
Moderator: General Moderators
[solved]on-the-fly Text file -> save to Hardisk
Last edited by AGISB on Sat Sep 11, 2004 8:12 am, edited 1 time in total.
Ok got it working but it seems to have a small problem in IE .
Here is what I did:
Saving works both fine in Netscape and IE but if I choose the open option in the IE save window I get an error message as the temporary file does not get created.
I run XP with SP 2 installed.
Here is what I did:
Code: Select all
<?php
header('Content-type: text/plain');
header('Content-Disposition: attachment; filename="message.txt"');
echo "Date: $datefield\r\n";
echo "from: $fromaddr\r\n";
echo "to: $toaddr\r\n";
echo "Subject: $subject\r\n";
echo "-------------------------------------------\r\n\r\n";
echo "$message\r\n\r\n";
echo "-------------------------------------------\r\n";
exit();
?>I run XP with SP 2 installed.
Found a solution. I just added the following:
and it now works fine.
Code: Select all
<?php
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: pre-check=0, post-check=0, max-age=0');
header('Content-Transfer-Encoding: none');
?>