Re: tmpnam filename
| From: | Eric Pignot | Date: | Thu, 29 Aug 2002 11:36:28 +0000 |
| Subject: | Re: tmpnam filename | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-114497@lists.php.net to get a copy of this message | ||
Why do you use tmpfile and not tempnam, as you write it in the header of
your message ? it returns the name of the file, as you expect...
string tempnam ( string dir, string prefix)
Then, you'll just need to open the file returned by tempnam and write all
data inside...
regards
Eric
"Rus Foster" <rghf@fsck.me.uk> a écrit dans le message de news:
20020829111411.M47856-100000@freebsd.rf0.com...
> Hi All,
> I'm fairly new to this list/PHP and I've already hit a bit of a brick
> wall. I'm trying to write some data out to a temporary file then make a
> passthru call so that another program can take the file as input on the
> command line
>
> I first tried
>
> print "<p>Do stuff</p>";
> $temp = tmpfile();
> fwrite($temp, $text);
> passthru("/path/to/program $temp");
> fclose($temp); // this removes the file
>
> However I realised that $temp was a file handle rather than a filename. Is
> there anyway I can get the filename? A google and search on php.net
> doesn't show anything obvious
>
> Rgds
>
> Rus
>
> --
> http://www.fsck.me.uk - Rant wibble wave
> http://shells.fsck.me.uk - Hosting and stuff
>