|
Posted by Joseph Melnick on 09/19/05 03:56
Hello Gufo, You wrote:
"Gufo Rosso" <spammaaaaaaaaaaaaaa@libero.it> wrote in message
news:i4mXe.8267$Jr.145082@twister2.libero.it...
>
> "Joseph Melnick" <jmelnick@jphp.com> ha scritto nel messaggio
> news:BfadnUESO-0OJ7HeRVn-3g@rogers.com...
>> Hello Gufo, You wrote:
>> "Gufo Rosso" <spammaaaaaaaaaaaaaa@libero.it> wrote in message
>> news:BgXWe.6259$Jr.108294@twister2.libero.it...
>> >i have a problem in this code:
>> > i look manual.....
>> >
>> > $filew = "ftp://gufo:pizza@192.168.1.55:21/jj.php"; // file exists
>> > $str = $_POST['data']; // contenent
>> > $strwri = file_put_contents($filew,$str,0,1); <--- have a good example
>> > ?
>> >
>> >
>> > error :
>> >
>> > Warning: file_put_contents() expects parameter 4 to be resource (?????)
>> > integer given in C:\Programmi\Apache
>> > Group\Apache2\htdocs\klinza_3.0\admin\blocks\admin-ftp\p23_mod_0.php on
>> > line
>> > 79
>> >
>> >
>> file_put_contents() is similar to running fopen, fwrite and then fclose.
>>
>> Files and streams are system resources and are refered to with pointers
>> or
>> handles.
>>
>> $strwri = file_put_contents($filew,$str,0,1);
>>
>> Last two parameters are optional. Try:
>>
>> $strwri = file_put_contents($filew,$str);
>>
>
> ftp://gufo:pizza@192.168.1.55:21/jj.php
> Warning: file_put_contents(ftp://...@192.168.1.55:21/jj.php)
> [function.file-put-contents]: failed to open stream: Remote file already
> exists and overwrite context option not specified.<br /> FTP server
> reports
> 213 2382 in C:\Programmi\Apache
> Group\Apache2\htdocs\klinza_3.0\admin\blocks\admin-ftp\p23_mod_0.php on
> line
> 79
>
>> Joseph Melnick
>> JM Web Consultants
>> Toronto ON Canada
>>
this is the series of steps that are performed by file_put_contents();
<?php
$filew = "somefilename.ext";
$str = "this is some string I want to put into somefile.ext";
//open file in write mode truncate if it exists
$fp = fopen($filew, "w");
// write string to file resource
$strwri = fwrite($fp,$str);
// close file
fclose($fp);
?>
Joseph Melnick
JM Web Consultants
Toronto ON Canada
[Back to original message]
|