summaryrefslogtreecommitdiffstats
path: root/application/libraries/Tempfile.php
blob: f42efbfdfafc59b582fbe13c74b033f1ad43bc48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
/*
 * Copyright 2015 Florian "Bluewind" Pritz <bluewind@server-speed.net>
 *
 * 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;
	}
}