Re: Forcing a dynamic created text file to be saved

From: Date: Tue, 10 Apr 2001 22:11:59 +0000
Subject: Re: Forcing a dynamic created text file to be saved
Groups: php.general 
Request: Send a blank email to php-general+get-48093@lists.php.net to get a copy of this message
OK I know that. What I want to do is to have the save dialog displayed as if it was a HTTP file download procedure. If you click on a ZIP file say test.zip the save dialog will be displayed. I want to do the same but not with a phisical file. Instead I want to do it with the content of the page (text). ----- Original Message ----- From: "Brad S. Jackson" <bjackson@McLeodUSA.com> To: "Nando2" <nando@antunes.eti.br> Sent: Tuesday, April 10, 2001 7:00 PM Subject: Re: [PHP] Forcing a dynamic created text file to be saved Whether the save dialog is displayed is determined by the registry settings for the user's browser. You cannot control that by what you send. "Nando2" <nando@antunes.eti.br> wrote: Hello all! I have a PHP4 script that produces a text file and I would like that when the user access this script the text content of it was forced to be saved meaning that when the user selects it he/she will have the save dialog form to save the text file with the filename specified in the header function. So far I have managed to create the text file dynamicaly but still I have to click the browser's save button to save the file with the determined filename. I wanted it to be forced. Does anyone know how to do it ? Here's the code : <?php // Carlos Fernando Scheidecker Antunes : Test saving text files with PHP // this sets the content type as being plain text header("Content-Type : text/plain; charset=3D\"iso-8859-1\""); // this sets the file name header("Content-Disposition: filename=3D\"test.txt\""); // creates the dynamic content of the text file here print("TextFile test\r\n\"); for ($i=3D1; $i < 100; $i++) { print("This is line number ".$i."\r\n"); } ?> Thanks, Carlos Fernando Scheidecker Antunes

« previous php.general (#48093) next »