]>
Commit | Line | Data |
---|---|---|
d8c46ff7 GJ |
1 | <?php |
2 | ||
3 | class UploadedFile | |
4 | { | |
5 | /* Public attributes */ | |
6 | public $name; | |
7 | public $mime; | |
8 | public $size; | |
9 | public $tempfile; | |
10 | public $error; | |
11 | ||
12 | /** | |
13 | * SHA-1 checksum | |
14 | * | |
15 | * @var string 40 digit hexadecimal hash (160 bits) | |
16 | */ | |
17 | private $sha1; | |
18 | ||
19 | /** | |
20 | * Generates the SHA-1 or returns the cached SHA-1 hash for the file. | |
21 | * | |
22 | * @return string|false $sha1 | |
23 | */ | |
24 | public function getSha1() | |
25 | { | |
26 | if (!$this->sha1) { | |
27 | $this->sha1 = sha1_file($this->tempfile); | |
28 | } | |
29 | ||
30 | return $this->sha1; | |
31 | } | |
32 | } |