Question regarding fopen

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, I'm having a strange problem with fopen

For clearence, here is the phpinfo page:
http://www.grondengoed.nl/phpinfo.php

I will shortly explain the problem I'm having:
        $imagenamesmall = $foldersystem . '/' . $id . $imgstr . '-s' .
$i . '.jpg';
        echo $imagenamesmall; // For debugging purposses --> returns
exactly what I want.

        //attempt to create folder
        @mkdir($foldersystem);
        @chmod($foldersystem, 0777);


        //save picture
        if(!($handle = fopen($imagenamesmall, 'w'))){
            echo "Cannot open file (31)";
            exit;
        }

       //$imagesmall, contains the image resource

        if(fwrite($handle, $imagesmall) === FALSE) {
            echo "Cannot write to file (32)";
            exit;
        }

        fclose($handle);

Erverything works perfectly fine.But one thing, it doesn't give the
file the name that it should get. A name for instance has to be:
54961tdtdtdtd-s0.jpg
The number is the id of the database row, the 8 characters are random.
-s stands for small and 0 is the picture index.
When I echo the value, I get what I want. But when I save it, the
random 8 character string had become a totally different 8 character
string :S.

I have googled and checked things over and over again, cost me hours
and I still haven't found the reason. What is noticeable is that when
I leave one character away from the name, the value IS what it schould
be:S.

I really hope you can help me, if you need further info yust ask.

Thanks in advance.

regards,

Joep Roebroek

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux