$fileId = SP\Request::analyze('fileId', 0); $log = new \SP\Log(); if ($action == 'upload') { if (!is_array($_FILES["inFile"]) || $accountId === 0) { \SP\Response::printJSON(_('CONSULTA INVÁLIDA')); } $log->setAction(_('Subir Archivo')); $allowedExts = strtoupper(SP\Config::getValue('files_allowed_exts')); $allowedSize = SP\Config::getValue('files_allowed_size'); if ($allowedExts) { // Extensiones aceptadas $extsOk = explode(",", $allowedExts); } else { $log->addDescription(_('No hay extensiones permitidas')); $log->writeLog(); \SP\Response::printJSON($log->getDescription()); } if (is_array($_FILES) && $_FILES['inFile']['name']) { // Comprobamos la extensión del archivo $fileData['extension'] = strtoupper(pathinfo($_FILES['inFile']['name'], PATHINFO_EXTENSION)); if (!in_array($fileData['extension'], $extsOk)) { $log->addDescription(_('Tipo de archivo no soportado') . " '" . $fileData['extension'] . "' "); $log->writeLog(); \SP\Response::printJSON($log->getDescription()); } } else { $log->addDescription(_('Archivo inválido') . ":<br>" . $_FILES['inFile']['name']); $log->writeLog(); \SP\Response::printJSON($log->getDescription()); } // Variables con información del archivo
$fileId = SP\Request::analyze('fileId', 0); $log = new \SP\Log(); if ($action == 'upload') { if (!is_array($_FILES["inFile"]) || !$accountId === 0) { exit; } $log->setAction(_('Subir Archivo')); $allowedExts = strtoupper(SP\Config::getValue('files_allowed_exts')); $allowedSize = SP\Config::getValue('files_allowed_size'); if ($allowedExts) { // Extensiones aceptadas $extsOk = explode(",", $allowedExts); } else { $log->addDescription(_('No hay extensiones permitidas')); $log->writeLog(); exit($log->getDescription()); } if (is_array($_FILES) && $_FILES['inFile']['name']) { // Comprobamos la extensión del archivo $fileData['extension'] = strtoupper(pathinfo($_FILES['inFile']['name'], PATHINFO_EXTENSION)); if (!in_array($fileData['extension'], $extsOk)) { $log->addDescription(_('Tipo de archivo no soportado') . " '" . $fileData['extension'] . "' "); $log->writeLog(); exit($log->getDescription()); } } else { $log->addDescription(_('Archivo inválido') . ":<br>" . $_FILES['inFile']['name']); $log->writeLog(); exit($log->getDescription()); } // Variables con información del archivo