Implement feature #2843

This commit is contained in:
phecho
2016-12-13 19:49:16 +08:00
parent f83178bef8
commit 89feb0ae03
3 changed files with 49 additions and 0 deletions

View File

@@ -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;
}
}