note 39341 rejected from function.fwrite by tomsommer

From: Date: Sun, 25 Jan 2004 14:55:24 +0000
Subject: note 39341 rejected from function.fwrite by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-64147@lists.php.net to get a copy of this message
Note Submitter: bilkan@hotmail.com ---- I wrote the following code: $input = ""; if(isset( $_POST['text_input'])) $input = $_POST['text_input']; $low_input = strtolower($input); $stringArray = explode(" ",$low_input); $FileToWrite = 'c:\\inetpub\\wwwroot\\movies\\test.txt'; function fileWrite($str_array,$file) { fopen($file,'wb'); fwrite($file, "["); for($i = 0; $i < count($str_array); $i++) { fwrite($file, "$str_array[$i],"); } fwrite($file, "]"); fclose($file); } fileWrite($stringArray,$FileToWrite); The progam creates the file "test.txt" but i have the following errors in the page: Warning: fwrite(): supplied argument is not a valid stream resource in c:\inetpub\wwwroot\movies\b.php on line 14 Warning: fwrite(): supplied argument is not a valid stream resource in c:\inetpub\wwwroot\movies\b.php on line 17 Warning: fwrite(): supplied argument is not a valid stream resource in c:\inetpub\wwwroot\movies\b.php on line 19 Warning: fclose(): supplied argument is not a valid stream resource in c:\inetpub\wwwroot\movies\b.php on line 20 Any idea why? thanks...

« previous php.notes (#64147) next »