añadir nuevas funcionalidades
This commit is contained in:
23
app/Helpers/FileHelper.php
Normal file
23
app/Helpers/FileHelper.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
// En App\Helpers\FileHelper.php
|
||||
namespace App\Helpers;
|
||||
|
||||
class FileHelper
|
||||
{
|
||||
public static function getFileType($filename)
|
||||
{
|
||||
$extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
|
||||
|
||||
return match($extension) {
|
||||
'pdf' => 'pdf',
|
||||
'doc', 'docx' => 'word',
|
||||
'xls', 'xlsx' => 'excel',
|
||||
'ppt', 'pptx' => 'powerpoint',
|
||||
'jpg', 'jpeg', 'png', 'gif' => 'image',
|
||||
'zip', 'rar' => 'archive',
|
||||
'txt' => 'text',
|
||||
default => 'document'
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user