summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inc/io.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/inc/io.php b/inc/io.php
index 405786cc2..eb9366c25 100644
--- a/inc/io.php
+++ b/inc/io.php
@@ -439,6 +439,26 @@ function io_mkdir_ftp($dir){
}
/**
+ * 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
*
* if $useAttachment is false,