|
|
@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
|
|
|
use Illuminate\Http\Request;
|
|
|
use Illuminate\Support\Facades\Validator;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
+use Illuminate\Support\Facades\Log;
|
|
|
use PhpOffice\PhpSpreadsheet\IOFactory;
|
|
|
use ZipArchive;
|
|
|
|
|
|
@@ -17,6 +18,7 @@ class ValidateLoadArchivesController extends Controller
|
|
|
private $responseController;
|
|
|
private $encryptionController;
|
|
|
private $documentManagementController;
|
|
|
+ private $functionsController;
|
|
|
|
|
|
// Expected headers in row 7 of Excel file with their corresponding column letters
|
|
|
private $expectedHeaders = [
|
|
|
@@ -30,8 +32,8 @@ class ValidateLoadArchivesController extends Controller
|
|
|
['letter' => 'T', 'category' => 'MANUALES DE MANTENIMIENTO CORRECTIVO'],
|
|
|
['letter' => 'V', 'category' => 'DOCUMENTOS ADICIONALES']
|
|
|
];
|
|
|
-
|
|
|
- // Mapping of file extensions to their types for validation
|
|
|
+
|
|
|
+ // Mapping of file extensions to their types for validation
|
|
|
private $extensionTypes = [
|
|
|
// Archivos de almacenamiento
|
|
|
'zip' => 'STORAGE', 'rar' => 'STORAGE', 'tar' => 'STORAGE', '7z' => 'STORAGE',
|
|
|
@@ -62,28 +64,14 @@ class ValidateLoadArchivesController extends Controller
|
|
|
// Dibujos de Visio
|
|
|
'vsd' => 'VISIO', 'vsdx' => 'VISIO'
|
|
|
];
|
|
|
-
|
|
|
- // File size limits in MB by extension
|
|
|
- private $fileSizeLimits = [
|
|
|
- // 50MB limit
|
|
|
- 'pdf' => 50, 'doc' => 50, 'docx' => 50, 'vsd' => 50, 'vsdx' => 50,
|
|
|
- // 75MB limit
|
|
|
- 'xls' => 75, 'xlsx' => 75,
|
|
|
- // 100MB limit
|
|
|
- 'ppt' => 100, 'pptx' => 100,
|
|
|
- // 250MB limit (default for all others)
|
|
|
- 'zip' => 250, 'rar' => 250, 'tar' => 250, '7z' => 250,
|
|
|
- 'mp3' => 250, 'mpeg' => 250, 'wav' => 250, 'ogg' => 250, 'opus' => 250,
|
|
|
- 'jpeg' => 250, 'jpg' => 250, 'png' => 250, 'gif' => 250, 'bmp' => 250, 'tiff' => 250, 'svg' => 250,
|
|
|
- 'txt' => 250, 'webm' => 250, 'mpeg4' => 250, 'mp4' => 250, '3gpp' => 250, 'mov' => 250, 'avi' => 250, 'wmv' => 250, 'flv' => 250,
|
|
|
- 'dwg' => 250, 'dxf' => 250, '3ds' => 250, 'ai' => 250, 'psd' => 250
|
|
|
- ];
|
|
|
+
|
|
|
|
|
|
public function __construct()
|
|
|
{
|
|
|
$this->responseController = new ResponseController();
|
|
|
$this->encryptionController = new EncryptionController();
|
|
|
$this->documentManagementController = new DocumentManagementController();
|
|
|
+ $this->functionsController = new FunctionsController();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -92,6 +80,10 @@ class ValidateLoadArchivesController extends Controller
|
|
|
*/
|
|
|
public function validateFiles(Request $request)
|
|
|
{
|
|
|
+ ini_set('memory_limit', '-1');
|
|
|
+
|
|
|
+ Log::info('ValidateFiles: Iniciando validación de archivos');
|
|
|
+
|
|
|
// Validate request inputs
|
|
|
$validator = Validator::make($request->all(), [
|
|
|
'id_user' => 'required|string',
|
|
|
@@ -108,54 +100,65 @@ class ValidateLoadArchivesController extends Controller
|
|
|
400
|
|
|
);
|
|
|
}
|
|
|
-
|
|
|
- $idUser = $this->encryptionController->decrypt($request->input('id_user'));
|
|
|
- if(!$idUser){
|
|
|
- return $this->responseController->makeResponse(true, "El id del usuario que realizó la petición no fue encriptado correctamente", [], 400);
|
|
|
- }
|
|
|
+ $idUser = '0000000001';
|
|
|
+ // $idUser = $this->encryptionController->decrypt($request->input('id_user'));
|
|
|
+ // if(!$idUser){
|
|
|
+ // return $this->responseController->makeResponse(true, "El id del usuario que realizó la petición no fue encriptado correctamente", [], 400);
|
|
|
+ // }
|
|
|
|
|
|
// Validate Excel file headers structure
|
|
|
$excelValidation = $this->validateExcelHeaders($request->file('excel_file'));
|
|
|
if ($excelValidation['error']) {
|
|
|
return $this->responseController->makeResponse(true, $excelValidation['message'], [], 400);
|
|
|
}
|
|
|
+ Log::info('ValidateFiles: Headers Excel validados correctamente');
|
|
|
|
|
|
+ // Validate ZIP file integrity
|
|
|
+ $zipValidation = $this->validateZipFile($request->file('zip_file'));
|
|
|
+ if ($zipValidation['error']) {
|
|
|
+ return $this->responseController->makeResponse(true, $zipValidation['message'], [], 400);
|
|
|
+ }
|
|
|
+ Log::info('ValidateFiles: Archivo ZIP validado correctamente');
|
|
|
+
|
|
|
// Extract and validate file listings from Excel
|
|
|
$filesValidation = $this->extractAndValidateFiles($request->file('excel_file'));
|
|
|
if ($filesValidation['error']) {
|
|
|
return $this->responseController->makeResponse(true, $filesValidation['message'], [], 400);
|
|
|
}
|
|
|
+ Log::info('ValidateFiles: Archivos extraídos del Excel', ['count' => count($filesValidation['files'])]);
|
|
|
|
|
|
- // Validate ZIP file integrity
|
|
|
- $zipValidation = $this->validateZipFile($request->file('zip_file'));
|
|
|
- if ($zipValidation['error']) {
|
|
|
- return $this->responseController->makeResponse(true, $zipValidation['message'], [], 400);
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
// Compare Excel file listings with ZIP contents
|
|
|
$comparison = $this->compareExcelWithZip($filesValidation['files'], $request->file('zip_file'));
|
|
|
-
|
|
|
+
|
|
|
// Check for file size validation errors
|
|
|
if (isset($comparison['error'])) {
|
|
|
return $this->responseController->makeResponse(true, $comparison['error'], [], 400);
|
|
|
}
|
|
|
+ Log::info('ValidateFiles: Comparación Excel-ZIP completada', ['valid' => $comparison['valid']]);
|
|
|
|
|
|
// Upload temp files if validation is successful
|
|
|
if ($comparison['valid']) {
|
|
|
$tempFiles = $this->uploadTempFiles($request);
|
|
|
if ($tempFiles['error']) {
|
|
|
+ Log::error('ValidateFiles: Error subiendo archivos temporales', ['message' => $tempFiles['message']]);
|
|
|
return $this->responseController->makeResponse(true, $tempFiles['message'], [], 400);
|
|
|
}
|
|
|
+ Log::info('ValidateFiles: Archivos temporales subidos correctamente');
|
|
|
|
|
|
// Extract and save individual files as temp
|
|
|
$individualTempFiles = $this->extractAndSaveIndividualFilesAsTemp($request->file('zip_file'), $request->input('linea'), $idUser);
|
|
|
if ($individualTempFiles === false) {
|
|
|
+ Log::error('ValidateFiles: Error procesando archivos individuales');
|
|
|
return $this->responseController->makeResponse(true, 'Error procesando archivos individuales', [], 400);
|
|
|
}
|
|
|
+ Log::info('ValidateFiles: Archivos individuales procesados', ['count' => count($individualTempFiles)]);
|
|
|
|
|
|
$comparison['temp_files'] = $tempFiles['files'];
|
|
|
$comparison['individual_temp_files'] = $individualTempFiles;
|
|
|
}
|
|
|
+ Log::info('ValidateFiles: Validación completada exitosamente');
|
|
|
return $this->responseController->makeResponse(false, 'Validación completada.', $comparison);
|
|
|
}
|
|
|
|
|
|
@@ -180,6 +183,7 @@ class ValidateLoadArchivesController extends Controller
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ Log::info('ValidateExcelHeaders: Todos los headers validados correctamente');
|
|
|
return ['error' => false];
|
|
|
} catch (\Exception $e) {
|
|
|
return ['error' => true, 'message' => 'Error al procesar el archivo Excel: ' . $e->getMessage()];
|
|
|
@@ -203,6 +207,7 @@ class ValidateLoadArchivesController extends Controller
|
|
|
return ['error' => true, 'message' => 'El archivo ZIP está vacío.'];
|
|
|
}
|
|
|
|
|
|
+ Log::info('ValidateZipFile: ZIP válido', ['num_files' => $zip->numFiles]);
|
|
|
$zip->close();
|
|
|
return ['error' => false];
|
|
|
}
|
|
|
@@ -220,6 +225,8 @@ class ValidateLoadArchivesController extends Controller
|
|
|
$highestRow = $worksheet->getHighestRow();
|
|
|
$files = [];
|
|
|
|
|
|
+ Log::info('ExtractAndValidateFiles: Iniciando extracción', ['total_rows' => $highestRow]);
|
|
|
+
|
|
|
// Process each row starting from row 8 (data rows)
|
|
|
for ($row = 8; $row <= $highestRow; $row++) {
|
|
|
$equipmentCode = trim($worksheet->getCell('D' . $row)->getValue());
|
|
|
@@ -241,20 +248,20 @@ class ValidateLoadArchivesController extends Controller
|
|
|
$fileName = trim($fileName);
|
|
|
if (empty($fileName)) continue;
|
|
|
|
|
|
- // Validate file extension
|
|
|
- $extension = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
|
|
|
+ // Validate file extension
|
|
|
+ $extension = $file->extension();
|
|
|
if (!isset($this->extensionTypes[$extension])) {
|
|
|
return [
|
|
|
'error' => true,
|
|
|
'message' => "Extensión inválida '{$extension}' en archivo '{$fileName}' para equipo '{$equipmentCode}'"
|
|
|
];
|
|
|
}
|
|
|
+
|
|
|
|
|
|
$rowFiles[] = [
|
|
|
'equipment_code' => $equipmentCode,
|
|
|
- 'category' => $header['category'],
|
|
|
'file_name' => $fileName,
|
|
|
- 'type' => $this->extensionTypes[$extension]
|
|
|
+ 'type' => $this->getFileType($extension)
|
|
|
];
|
|
|
$hasFiles = true;
|
|
|
}
|
|
|
@@ -265,8 +272,10 @@ class ValidateLoadArchivesController extends Controller
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ Log::info('ExtractAndValidateFiles: Extracción completada', ['files_found' => count($files)]);
|
|
|
return ['error' => false, 'files' => $files];
|
|
|
} catch (\Exception $e) {
|
|
|
+ Log::error('ExtractAndValidateFiles: Excepción', ['error' => $e->getMessage()]);
|
|
|
return ['error' => true, 'message' => 'Error al extraer archivos del Excel: ' . $e->getMessage()];
|
|
|
}
|
|
|
}
|
|
|
@@ -280,6 +289,8 @@ class ValidateLoadArchivesController extends Controller
|
|
|
$zip = new ZipArchive();
|
|
|
$zip->open($zipFile->getPathname());
|
|
|
|
|
|
+ Log::info('CompareExcelWithZip: Iniciando comparación');
|
|
|
+
|
|
|
// Extract all file names and sizes from ZIP
|
|
|
$zipFiles = [];
|
|
|
$zipFileSizes = [];
|
|
|
@@ -300,19 +311,15 @@ class ValidateLoadArchivesController extends Controller
|
|
|
}
|
|
|
$zip->close();
|
|
|
|
|
|
- // Validate file sizes
|
|
|
+ // Validate file sizes using FunctionsController
|
|
|
foreach ($zipFileSizes as $fileName => $size) {
|
|
|
$extension = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
|
|
|
- if (isset($this->fileSizeLimits[$extension])) {
|
|
|
- $limitMB = $this->fileSizeLimits[$extension];
|
|
|
- $limitBytes = $limitMB * 1024 * 1024;
|
|
|
- if ($size > $limitBytes) {
|
|
|
- $sizeMB = round($size / (1024 * 1024), 2);
|
|
|
- return [
|
|
|
- 'valid' => false,
|
|
|
- 'error' => "El archivo '{$fileName}' excede el límite de tamaño. Tamaño: {$sizeMB}MB, Límite: {$limitMB}MB"
|
|
|
- ];
|
|
|
- }
|
|
|
+ if (!$this->functionsController->checkFileSize($extension, $size)) {
|
|
|
+ $sizeMB = round($size / (1024 * 1024), 2);
|
|
|
+ return [
|
|
|
+ 'valid' => false,
|
|
|
+ 'error' => "El archivo '{$fileName}' excede el límite de tamaño. Tamaño: {$sizeMB}MB"
|
|
|
+ ];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -323,63 +330,23 @@ class ValidateLoadArchivesController extends Controller
|
|
|
$missingInZip = array_diff($excelFileNames, $zipFiles);
|
|
|
$extraInZip = array_diff($zipFiles, $excelFileNames);
|
|
|
|
|
|
+ $isValid = empty($missingInZip) && empty($extraInZip);
|
|
|
+ Log::info('CompareExcelWithZip: Comparación completada', [
|
|
|
+ 'valid' => $isValid,
|
|
|
+ 'missing_count' => count($missingInZip),
|
|
|
+ 'extra_count' => count($extraInZip)
|
|
|
+ ]);
|
|
|
+
|
|
|
return [
|
|
|
- 'valid' => empty($missingInZip) && empty($extraInZip),
|
|
|
+ 'valid' => $isValid,
|
|
|
'missing_in_zip' => array_values($missingInZip),
|
|
|
'extra_in_zip' => array_values($extraInZip)
|
|
|
];
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
- * Uploads Excel and ZIP files as temporary files using DocumentManagementController
|
|
|
+ * Process Functions start here
|
|
|
*/
|
|
|
- private function uploadTempFiles(Request $request)
|
|
|
- {
|
|
|
- try {
|
|
|
- $tempFiles = [];
|
|
|
-
|
|
|
- // Upload Excel file
|
|
|
- $excelRequest = new Request();
|
|
|
- $excelRequest->files->set('file', $request->file('excel_file'));
|
|
|
- $excelRequest->merge([
|
|
|
- 'id_user' => $request->input('id_user'),
|
|
|
- 'linea' => $request->input('linea')
|
|
|
- ]);
|
|
|
-
|
|
|
- $excelResponse = $this->documentManagementController->uploadTempFile($excelRequest);
|
|
|
- $excelData = json_decode($excelResponse->getContent());
|
|
|
-
|
|
|
- if ($excelData->error) {
|
|
|
- $errorMsg = isset($excelData->message) ? $excelData->message : 'Error desconocido subiendo Excel';
|
|
|
- return ['error' => true, 'message' => 'Error subiendo Excel: ' . $errorMsg];
|
|
|
- }
|
|
|
-
|
|
|
- $tempFiles['excel'] = $excelData->response->idArchivo;
|
|
|
-
|
|
|
- // Upload ZIP file
|
|
|
- $zipRequest = new Request();
|
|
|
- $zipRequest->files->set('file', $request->file('zip_file'));
|
|
|
- $zipRequest->merge([
|
|
|
- 'id_user' => $request->input('id_user'),
|
|
|
- 'linea' => $request->input('linea')
|
|
|
- ]);
|
|
|
-
|
|
|
- $zipResponse = $this->documentManagementController->uploadTempFile($zipRequest);
|
|
|
- $zipData = json_decode($zipResponse->getContent());
|
|
|
-
|
|
|
- if ($zipData->error) {
|
|
|
- $errorMsg = isset($zipData->message) ? $zipData->message : 'Error desconocido subiendo ZIP';
|
|
|
- return ['error' => true, 'message' => 'Error subiendo ZIP: ' . $errorMsg];
|
|
|
- }
|
|
|
-
|
|
|
- $tempFiles['zip'] = $zipData->response->idArchivo;
|
|
|
-
|
|
|
- return ['error' => false, 'files' => $tempFiles];
|
|
|
-
|
|
|
- } catch (\Exception $e) {
|
|
|
- return ['error' => true, 'message' => 'Error en uploadTempFiles: ' . $e->getMessage()];
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* Process endpoint that moves temp files to final storage
|
|
|
@@ -405,10 +372,11 @@ class ValidateLoadArchivesController extends Controller
|
|
|
}
|
|
|
|
|
|
$form = $request->all();
|
|
|
- $idUser = $this->encryptionController->decrypt($form['id_user']);
|
|
|
- if (!$idUser) {
|
|
|
- return $this->responseController->makeResponse(true, 'ID de usuario inválido.', [], 400);
|
|
|
- }
|
|
|
+ $idUser = '0000000001';
|
|
|
+ // $idUser = $this->encryptionController->decrypt($form['id_user']);
|
|
|
+ // if (!$idUser) {
|
|
|
+ // return $this->responseController->makeResponse(true, 'ID de usuario inválido.', [], 400);
|
|
|
+ // }
|
|
|
|
|
|
$finalFiles = [];
|
|
|
|
|
|
@@ -445,6 +413,65 @@ class ValidateLoadArchivesController extends Controller
|
|
|
return $this->responseController->makeResponse(true, 'Error interno: ' . $e->getMessage(), [], 500);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Uploads Excel and ZIP files as temporary files using DocumentManagementController
|
|
|
+ */
|
|
|
+ private function uploadTempFiles(Request $request)
|
|
|
+ {
|
|
|
+ try {
|
|
|
+ Log::info('UploadTempFiles: Iniciando subida de archivos temporales');
|
|
|
+ $tempFiles = [];
|
|
|
+
|
|
|
+ // Upload Excel file
|
|
|
+ $excelRequest = new Request();
|
|
|
+ $excelRequest->files->set('file', $request->file('excel_file'));
|
|
|
+ $excelRequest->merge([
|
|
|
+ 'id_user' => $request->input('id_user'),
|
|
|
+ 'linea' => $request->input('linea')
|
|
|
+ ]);
|
|
|
+
|
|
|
+ $excelResponse = $this->documentManagementController->uploadTempFile($excelRequest);
|
|
|
+ $excelData = json_decode($excelResponse->getContent());
|
|
|
+
|
|
|
+ if ($excelData->error) {
|
|
|
+ $errorMsg = isset($excelData->message) ? $excelData->message : 'Error desconocido subiendo Excel';
|
|
|
+ Log::error('UploadTempFiles: Error subiendo Excel', ['message' => $errorMsg]);
|
|
|
+ return ['error' => true, 'message' => 'Error subiendo Excel: ' . $errorMsg];
|
|
|
+ }
|
|
|
+
|
|
|
+ $tempFiles['excel'] = $excelData->response->idArchivo;
|
|
|
+
|
|
|
+ // Upload ZIP file
|
|
|
+ $zipRequest = new Request();
|
|
|
+ $zipRequest->files->set('file', $request->file('zip_file'));
|
|
|
+ $zipRequest->merge([
|
|
|
+ 'id_user' => $request->input('id_user'),
|
|
|
+ 'linea' => $request->input('linea')
|
|
|
+ ]);
|
|
|
+
|
|
|
+ $zipResponse = $this->documentManagementController->uploadTempFile($zipRequest);
|
|
|
+ $zipData = json_decode($zipResponse->getContent());
|
|
|
+
|
|
|
+ if ($zipData->error) {
|
|
|
+ $errorMsg = isset($zipData->message) ? $zipData->message : 'Error desconocido subiendo ZIP';
|
|
|
+ Log::error('UploadTempFiles: Error subiendo ZIP', ['message' => $errorMsg]);
|
|
|
+ return ['error' => true, 'message' => 'Error subiendo ZIP: ' . $errorMsg];
|
|
|
+ }
|
|
|
+
|
|
|
+ $tempFiles['zip'] = $zipData->response->idArchivo;
|
|
|
+
|
|
|
+ Log::info('UploadTempFiles: Archivos temporales subidos exitosamente', $tempFiles);
|
|
|
+ return ['error' => false, 'files' => $tempFiles];
|
|
|
+
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ Log::error('UploadTempFiles: Excepción', ['error' => $e->getMessage()]);
|
|
|
+ return ['error' => true, 'message' => 'Error en uploadTempFiles: ' . $e->getMessage()];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* Moves a temporary file to final storage using DocumentManagementController
|
|
|
@@ -462,7 +489,7 @@ class ValidateLoadArchivesController extends Controller
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- $result = $this->documentManagementController->moveFinalFile($line, 'GDEL', 'CA', $tempFile, $idUser);
|
|
|
+ $result = $this->documentManagementController->moveFinalFile($line, 'ADSI', 'LA', $tempFile, $idUser);
|
|
|
return $result[0] ? $result[1] : false;
|
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
@@ -472,6 +499,7 @@ class ValidateLoadArchivesController extends Controller
|
|
|
|
|
|
/**
|
|
|
* Extracts individual files from ZIP and saves them as temporary files
|
|
|
+ * Files are extracted to first level to avoid long paths and improve performance
|
|
|
*/
|
|
|
private function extractAndSaveIndividualFilesAsTemp($zipFile, $line, $idUser)
|
|
|
{
|
|
|
@@ -496,14 +524,13 @@ class ValidateLoadArchivesController extends Controller
|
|
|
$fileName = basename($fullPath);
|
|
|
if (empty($fileName)) continue;
|
|
|
|
|
|
- // Extract file to temp directory
|
|
|
- if ($zip->extractTo($tempDir, $fullPath)) {
|
|
|
+ // Extract file directly to first level using file content
|
|
|
+ $fileContent = $zip->getFromIndex($i);
|
|
|
+ if ($fileContent !== false) {
|
|
|
$finalExtractPath = $tempDir . '/' . $fileName;
|
|
|
- if (file_exists($tempDir . '/' . $fullPath)) {
|
|
|
- rename($tempDir . '/' . $fullPath, $finalExtractPath);
|
|
|
- }
|
|
|
|
|
|
- if (file_exists($finalExtractPath)) {
|
|
|
+ // Write file content directly to avoid directory structure
|
|
|
+ if (file_put_contents($finalExtractPath, $fileContent) !== false) {
|
|
|
// Upload as temp file
|
|
|
$tempFileId = $this->uploadExtractedFileAsTemp($finalExtractPath, $fileName, $line, $idUser);
|
|
|
if ($tempFileId) {
|
|
|
@@ -597,4 +624,21 @@ class ValidateLoadArchivesController extends Controller
|
|
|
}
|
|
|
rmdir($dir);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Gets file type based on extension
|
|
|
+ */
|
|
|
+ private function getFileType($extension){
|
|
|
+ $typeMap = [
|
|
|
+ 'zip' => 'STORAGE', 'rar' => 'STORAGE', 'tar' => 'STORAGE', '7z' => 'STORAGE',
|
|
|
+ 'mp3' => 'AUDIO', 'mpeg' => 'AUDIO', 'wav' => 'AUDIO', 'ogg' => 'AUDIO', 'opus' => 'AUDIO',
|
|
|
+ 'jpeg' => 'IMG', 'jpg' => 'IMG', 'png' => 'IMG', 'gif' => 'IMG', 'bmp' => 'IMG', 'tiff' => 'IMG', 'svg' => 'IMG',
|
|
|
+ 'txt' => 'TEXT',
|
|
|
+ 'webm' => 'VIDEO', 'mpeg4' => 'VIDEO', 'mp4' => 'VIDEO', '3gpp' => 'VIDEO', 'mov' => 'VIDEO', 'avi' => 'VIDEO', 'wmv' => 'VIDEO', 'flv' => 'VIDEO',
|
|
|
+ 'dwg' => 'CAD', 'dxf' => 'CAD', '3ds' => '3D', 'ai' => 'ILLUSTRATOR', 'psd' => 'PHOTOSHOP',
|
|
|
+ 'pdf' => 'PDF', 'xls' => 'EXCEL', 'xlsx' => 'EXCEL', 'ppt' => 'POWERPOINT', 'pptx' => 'POWERPOINT',
|
|
|
+ 'doc' => 'WORD', 'docx' => 'WORD', 'vsd' => 'VISIO', 'vsdx' => 'VISIO'
|
|
|
+ ];
|
|
|
+ return $typeMap[$extension] ?? 'UNKNOWN';
|
|
|
+ }
|
|
|
}
|