Hi,
Can anyone give a sample script to download a text file?
You see, I had a product table in mysql then I had a script that will read the contents of the table and write it in the text file. After writing to the text file, the script should automatically download the newly created text file from the server.
I used this code:
[code=php]header(‘location: product.txt’);
But instead of showing the download pop-up window, it will display the entire contents of the text file in the browser.
I also tried this:
[code=php]header(‘Content-Disposition: attachment; filename=product.txt’);
It shows the pup-up window and downloads the file but the problem is that the contents of the file is not the products table contents but that of the scripts running.
What will be the correct code for this?