RE: [PHP] Saving to a file

From: Date: Wed, 20 Jun 2001 13:55:38 +0000
Subject: RE: [PHP] Saving to a file
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-54518@lists.php.net to get a copy of this message
Rosen, Depends on where you want to save the file. To get the manual http://www.php.net/docs.php. To Save to a file on the machine running the browser; make a form that outputs absolutely nothing except; header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=filename.txt"); while(list($key,$val) = each($prod)) { // the echo below sends the file contents $id = $val[0]; // data was loaded to array $prod as follows; $nm = $val[1]; // $prod[] = array($productNo, $productDescr); echo("$id,$nm\r\n"); // use \r\n if going to windows browser \n if going to unix } To Save a file to the server machine hosting your website; use normal fopen, fputs, etc (see the manual) good luck, Warren Vail -----Original Message----- From: Rosen [mailto:rosen_dm@dir.bg] Sent: Wednesday, June 20, 2001 1:04 AM To: php-general@lists.php.net Subject: [PHP] Saving to a file Hi, Sorry for the stupid question, but i don't have at me a PHP manual and I want to save some string to file from PHP. Can someone tell me how ( with what function to do this ) ? Thanks Rosen

« previous php.general (#54518) next »