You have these two lines $fp2 = "C:\\inetpub\\wwwroot\packtracker\\LSE\\".$cr.".txt"; $fp3 = "C:\\inetpub\\wwwroot\packtracker\\LSE\\".$cr.".doc"; Why do you have double slashes on every place but one ? :-) Luis ----- Original Message ----- From: "George Pitcher" <george.pitcher@ingenta.com> To: <php-windows@lists.php.net> Sent: Tuesday, September 09, 2003 3:37 PM Subject: [PHP-WIN] Problem writing to a file > Hi all, > > I'm having a problem writing to a text file. > > This is the error message: > = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = > Warning: fwrite(): > supplied argument is not a valid stream resource in > C:\Inetpub\wwwroot\packtracker\lse\pub_req_start2.php on line 276 > Cannot write to file > (C:\inetpub\wwwroot\packtracker\LSE\IR201_1770.txt) > = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = > > This is the code: > ----------------------------------------------------------------- > $fp2 = "C:\\inetpub\\wwwroot\packtracker\\LSE\\".$cr.".txt"; > $fp3 = "C:\\inetpub\\wwwroot\packtracker\\LSE\\".$cr.".doc"; > $fn1 = file_get_contents("pub_letter.txt"); > // replace some of the content placeholders with variables <<< > $content = $fn1; > if (!$fp = fopen($fp2, 'w')) { > print "Cannot open the bloody file ($fp2)"; > exit; > } > // chmod($fp2,222); tried this - no effect > if (!fwrite($fp2, $content)) { > print "Cannot write to file ($fp2)"; > exit; > } > rename($fp2,$fp3); > fclose($fp3); > fclose($fp2); > if($contact_route == 'Email' | $contact_route == 'email') { > ---------------------------------------------------------------- > > So as you can see, I load a text file (actually its RTF saved as text), > parse it then write it to an open txt file, then rename that as a Word doc. > > I'm running this on NT with PHP 4.3.2. The folder has write access for the > web user. > > Any suggestions? > > Cheers > > George > > === > > George Pitcher > HERON Technical Manager > Ingenta plc > 23-38 Hythe Bridge Street, Oxford, OX1 2ET > T +44 (0)1865 799051 direct > T +44 (0)1865 799000 switchboard > F +44 (0)1865 799134 > E george.pitcher@ingenta.com > > www.ingenta.com > > Ingenta: Empowering the exchange of academic and professional content > online. > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php