I came to this page while trying to find out the filename that PHP's tmpfile() function had created - it returns a pointer. I wanted to use it to create a file I could use with some Unix commands. In the end I used tempnam(realpath(sys_get_temp_dir()), "piclib_"); instead.