From 1172f71ca8cc22384ab4bf7242c7645d88e0f6c8 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sat, 8 Nov 2014 17:25:31 +0100 Subject: Support multiple files with the same hash Signed-off-by: Florian Pritz --- application/libraries/Tempfile.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 application/libraries/Tempfile.php (limited to 'application/libraries/Tempfile.php') diff --git a/application/libraries/Tempfile.php b/application/libraries/Tempfile.php new file mode 100644 index 000000000..f42efbfdf --- /dev/null +++ b/application/libraries/Tempfile.php @@ -0,0 +1,31 @@ + + * + * Licensed under AGPLv3 + * (see COPYING for full license text) + * + */ + +namespace libraries; + +class Tempfile { + private $file; + + public function __construct() + { + $this->file = tempnam(sys_get_temp_dir(), "tempfile"); + } + + public function __destruct() + { + if (file_exists($this->file)) { + unlink($this->file); + } + } + + public function get_file() + { + return $this->file; + } +} -- cgit v1.2.3-24-g4f1b