get mimetype
This commit is contained in:
parent
017cbfa667
commit
a8b4b26c57
@ -27,6 +27,7 @@ class Filesystem {
|
||||
// $chunk = amount of chunks, FALSE if you don't want to chunk
|
||||
public static function listFiles($path, $regex='*', $extension='*', $sortByDate=false, $chunk=false)
|
||||
{
|
||||
error_log($path.$regex.'.'.$extension);
|
||||
$files = glob($path.$regex.'.'.$extension);
|
||||
|
||||
if (empty($files)) {
|
||||
@ -292,4 +293,18 @@ class Filesystem {
|
||||
return sprintf("%.{$decimals}f ", $bytes / pow(1024, $factor)) . @$size[$factor];
|
||||
}
|
||||
|
||||
/*
|
||||
| Returns the mime type of the file
|
||||
| Example:
|
||||
| @file /home/diego/dog.jpg
|
||||
| @return image/jpeg
|
||||
|
|
||||
| @file string Full path of the file
|
||||
|
|
||||
| @return string
|
||||
*/
|
||||
public static function mimeType($file) {
|
||||
return mime_content_type($file);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user