summaryrefslogtreecommitdiff
path: root/build/classes/UploadedFile.class.php
diff options
context:
space:
mode:
authorAustin Gillmann <alucard@cuntflaps.me>2017-01-04 02:12:58 +0100
committerAustin Gillmann <alucard@cuntflaps.me>2017-01-04 02:12:58 +0100
commitb4fc2f892b877fe0cfb90063248d720bf87b49c8 (patch)
treebc549baf7bbfcc1fb5af576a41fbce4439d3d1f4 /build/classes/UploadedFile.class.php
parent2a57c9e78f3b23c9251adfd8773681fe695fe76d (diff)
Merge php submodule into pomf, delete expiry.
Diffstat (limited to 'build/classes/UploadedFile.class.php')
-rw-r--r--build/classes/UploadedFile.class.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/build/classes/UploadedFile.class.php b/build/classes/UploadedFile.class.php
new file mode 100644
index 0000000..d90a9a4
--- /dev/null
+++ b/build/classes/UploadedFile.class.php
@@ -0,0 +1,32 @@
+<?php
+
+class UploadedFile
+{
+ /* Public attributes */
+ public $name;
+ public $mime;
+ public $size;
+ public $tempfile;
+ public $error;
+
+ /**
+ * SHA-1 checksum
+ *
+ * @var string 40 digit hexadecimal hash (160 bits)
+ */
+ private $sha1;
+
+ /**
+ * Generates the SHA-1 or returns the cached SHA-1 hash for the file.
+ *
+ * @return string|false $sha1
+ */
+ public function getSha1()
+ {
+ if (!$this->sha1) {
+ $this->sha1 = sha1_file($this->tempfile);
+ }
+
+ return $this->sha1;
+ }
+}