summaryrefslogtreecommitdiff
path: root/app/Helper/FileHelper.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Helper/FileHelper.php')
-rw-r--r--app/Helper/FileHelper.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/Helper/FileHelper.php b/app/Helper/FileHelper.php
index cabf371c..82b444d0 100644
--- a/app/Helper/FileHelper.php
+++ b/app/Helper/FileHelper.php
@@ -106,4 +106,23 @@ class FileHelper extends Base
return null;
}
+
+ /**
+ * Return the browser view mimetype based on the file extension.
+ *
+ * @param $filename
+ *
+ * @return string
+ */
+ public function getBrowserViewType($filename)
+ {
+ $extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
+
+ switch ($extension) {
+ case 'pdf':
+ return 'application/pdf';
+ }
+
+ return null;
+ }
}