Re: [PHP] file_put_contents problem

2009-09-14 Thread Andres Gonzalez

thank you for your responses.

This appears to be a CodeIgniter  problem because everything
of course works fine from a command line script. I will post
a question on their forum.

Thanks again.

-Andres



Jim Lucas wrote:

Andres Gonzalez wrote:
  

I have read in the contents of a file using file_get_contents. I can verify
that the data has actually been read in by echoing its contents.

But then if I do this:

$ret = file_put_contents("/tmp/bla", $bk);

The return value gives the correct size of string $bk, and the file
/tmp/bla
is created in /tmp, but the length is 0.

Why are not the contents written to the file?

-Andres




We will need to see a little more code before we can make assumptions.

Jim


  


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] file_put_contents problem

2009-09-14 Thread Jim Lucas
Andres Gonzalez wrote:
> I have read in the contents of a file using file_get_contents. I can verify
> that the data has actually been read in by echoing its contents.
> 
> But then if I do this:
> 
> $ret = file_put_contents("/tmp/bla", $bk);
> 
> The return value gives the correct size of string $bk, and the file
> /tmp/bla
> is created in /tmp, but the length is 0.
> 
> Why are not the contents written to the file?
> 
> -Andres
> 

We will need to see a little more code before we can make assumptions.

Jim


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] file_put_contents problem

2009-09-14 Thread J DeBord
On Mon, Sep 14, 2009 at 4:19 PM, Andres Gonzalez wrote:

> I have read in the contents of a file using file_get_contents. I can verify
> that the data has actually been read in by echoing its contents.
>
> But then if I do this:
>
> $ret = file_put_contents("/tmp/bla", $bk);
>
> The return value gives the correct size of string $bk, and the file
> /tmp/bla
> is created in /tmp, but the length is 0.
>
> Why are not the contents written to the file?
>

Hmmm. Hard to say.

This works for me:

$contents = 'Testing contents';
var_dump(file_put_contents(APPLICATION_PATH . '/../data/test.txt',
$contents));

Outputs: Int 16 and creates the file test.txt, and writes 'Testing contents'
to the file.



> -Andres
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


[PHP] file_put_contents problem

2009-09-14 Thread Andres Gonzalez

I have read in the contents of a file using file_get_contents. I can verify
that the data has actually been read in by echoing its contents.

But then if I do this:

$ret = file_put_contents("/tmp/bla", $bk);

The return value gives the correct size of string $bk, and the file /tmp/bla
is created in /tmp, but the length is 0.

Why are not the contents written to the file?

-Andres

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php