diff --git a/inc/io.php b/inc/io.php index 405786cc2ecdb2637d44aaf7437dd68772accb52..eb9366c25bfdf8589a788fc242043952d6697f0f 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 <chi@chimeric.de> + */ +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 *