summaryrefslogtreecommitdiffstats
path: root/application/models/mfile.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/models/mfile.php')
-rw-r--r--application/models/mfile.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/application/models/mfile.php b/application/models/mfile.php
index ef48a87c5..203e2e101 100644
--- a/application/models/mfile.php
+++ b/application/models/mfile.php
@@ -79,13 +79,20 @@ class Mfile extends CI_Model {
return $this->folder($hash).'/'.$hash;
}
+ // Return mimetype of file
+ function mimetype($file) {
+ $fileinfo = new finfo(FILEINFO_MIME_TYPE);
+ $mimetype = $fileinfo->file($file);
+
+ return $mimetype;
+ }
+
// Add a hash to the DB
function add_file($hash, $id, $filename)
{
$userid = $this->muser->get_userid();
- $fileinfo = new finfo(FILEINFO_MIME_TYPE);
- $mimetype = $fileinfo->file($this->file($hash));
+ $mimetype = $this->mimetype($this->file($hash));
$filesize = filesize($this->file($hash));
$query = $this->db->query('