From de86255546da549b16fa2a5f17f592831b6a1931 Mon Sep 17 00:00:00 2001 From: Michael Klier Date: Wed, 27 Feb 2008 23:16:31 +0100 Subject: introducing io_mktmpdir() darcs-hash:20080227221631-23886-1ce689e9616b6dd5d2cc55613b86ddff4e1808be.gz --- inc/io.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'inc/io.php') diff --git a/inc/io.php b/inc/io.php index 405786cc2..eb9366c25 100644 --- a/inc/io.php +++ b/inc/io.php @@ -438,6 +438,26 @@ function io_mkdir_ftp($dir){ return $ok; } +/** + * Creates a unique temporary directory and returns + * its path. + * + * @author Michael Klier + */ +function io_mktmpdir() { + global $conf; + + $base = $conf['savedir'].'/tmp/'; + $dir = md5(uniqid(rand(), true)); + $tmpdir = $base.$dir; + + if(io_mkdir_p($tmpdir)) { + return($tmpdir); + } else { + return false; + } +} + /** * downloads a file from the net and saves it * -- cgit v1.2.3