note 105482 deleted from function.file-put-contents by danbrown

From: Date: Mon, 22 Aug 2011 14:03:05 +0000
Subject: note 105482 deleted from function.file-put-contents by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-182644@lists.php.net to get a copy of this message
Note Submitter: GhostHawkins badbrizioAThotmailDOTit ---- HI, some months ago I used the advice of deqode @ 15-Feb-2010 how to use file_put_contents on FTP server: http://www.php.net/manual/en/function.file-put-contents.php#96217 Well, it worked for a lot but until we changed root server ... after that it sometimes save contents, sometimes save blank file. I hope you can help me cause i really don't know what to do. This is my code: $contents = $_POST['text']; $opts = array('ftp'=>array('overwrite'=> true)); $context = stream_context_create($opts); $ret = file_put_contents("ftp://$user:$pass@$host/$path/main/server.cfg", stripslashes($contents), false, $context) or die("Error"); Well ... if i try echo $ret i always have the number of byte, even when no one of $contents character is saved in the file. What can I do? I really hope you can help me :P Thanks. Fabrizio. PS: I noticed 1 thing ... i give to the file 777 but after file_put_contents it always changes to 644 even when no one of $contents character is saved in the file.

« previous php.notes (#182644) next »