Hello,
I want to make a small tool which shows the actual DB table description. There is no problem with it.
But I want to allow the user to choose download the result as a text file instead of displaying it in the browser. How can I do this?
Thanks!
Download output instead of display it
Moderator: General Moderators
You will have to build the string, write it to a file (txt file perhaps?) then use headers to download as a file.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Code: Select all
header("Content-type: text/plain"); //set the content type to a txt file
header("Content-Disposition: attachment; filename=mytabledump.txt"); //say its an attachment, thus download, and the donwload file name
header("Pragma: public"); //resolves ie6 error where content-disposition isn't always recognised
header("Cache-Control: max-age=0"); //don't cache it
echo $file_contents; //output the table dump to appear in the filehere are some mime types for downloading (by extension) always a useful reference
hope that helps