summaryrefslogtreecommitdiff
path: root/static/php/classes/UploadedFile.class.php
diff options
context:
space:
mode:
authorEliot Whalan <ewhal@pantsu.cat>2016-06-17 10:42:24 +0200
committerEliot Whalan <ewhal@pantsu.cat>2016-06-17 10:42:24 +0200
commita3643179b262005d2cd251fb4defb3884ab814ae (patch)
tree07f541584f9abd19de91b34d944dd2ef85572604 /static/php/classes/UploadedFile.class.php
parent0b09cabbd7f684475ba4b28eb99a8182e880717b (diff)
Create php file
Diffstat (limited to 'static/php/classes/UploadedFile.class.php')
-rw-r--r--static/php/classes/UploadedFile.class.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/static/php/classes/UploadedFile.class.php b/static/php/classes/UploadedFile.class.php
new file mode 100644
index 0000000..03b7429
--- /dev/null
+++ b/static/php/classes/UploadedFile.class.php
@@ -0,0 +1,33 @@
+<?php
+
+class UploadedFile
+{
+ /* Public attributes */
+ public $name;
+ public $mime;
+ public $size;
+ public $tempfile;
+ public $error;
+
+ /**
+ * SHA-1 checksum
+ *
+ * @deprecated 2.1.0 To be replaced with SHA-256 hashing.
+ * @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;
+ }
+}