Re: tempnam() not working as expected...

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

 




tamouse mailing lists <tamouse.lists@xxxxxxxxx> hat am 14. April 2012 um
00:05 geschrieben:

> Can someone explain the following to me:
>
>
> <?php
> $d=tempnam(".","dir");                 /* create a temp named file *

> unlink($d);                         /* unlink it because we're going to
make it a directory */
> mkdir($d,777,true);                /* make the directory */
> echo "$d is ". (is_dir($d)?'':'NOT')." a directory\n";
>
>
> $f=tempnam($d,"file");                /* using the first directory,
create a new
> temp named file */
> unlink($f);                        /* unlink it as we're going to make it
a directory */
> mkdir($f,777,true);                /* make the directory */
> echo "$f is ". (is_dir($f)?'':'NOT')." a directory\n";
> ?>
>
> /Users/tamara/Sites/gallery/lib/common/t/dirGuWOLW is  a directory
> /private/var/folders/pI/pIx-p0mhH5eEQ64yAiDQmE+++TI/-Tmp-/fileC7Rnzg
> is  a directory

Could you do an "ls -la" for both files and send the output?
Try using "mkdir($d, 0777, true);"


>
> Why isn't the second tempnam using the directory path I pass to it?
>
> The strange thing I notice is that if I pass in a directory path to
> tempnam that was NOT created initially by tempnam, it works:
>
> miishka:t tamara$ mkdir a
> miishka:t tamara$ php -r 'echo
> tempnam("/Users/tamara/Sites/gallery/lib/common/t/a","file").PHP_EOL;'
> /Users/tamara/Sites/gallery/lib/common/t/a/filepSwRzF
> miishka:t tamara$
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: marco@xxxxxxxxxx

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

-- 
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