/** * Guardar un archivo en la BBDD. * * @param int $accountId * @param array $fileData con los datos y el contenido del archivo * @return bool */ public static function fileUpload($accountId, &$fileData = array()) { $query = "INSERT INTO accFiles " . "SET accfile_accountId = :accountId," . "accfile_name = :name," . "accfile_type = :type," . "accfile_size = :size," . "accfile_content = :blobcontent," . "accfile_extension = :extension," . "accfile_thumb = :thumbnail"; $data['accountId'] = $accountId; $data['name'] = $fileData['name']; $data['type'] = $fileData['type']; $data['size'] = $fileData['size']; $data['blobcontent'] = $fileData['content']; $data['extension'] = $fileData['extension']; $data['thumbnail'] = ImageUtil::createThumbnail($fileData['content'], $fileData['type']); if (DB::getQuery($query, __FUNCTION__, $data) === true) { $log = new Log(_('Subir Archivo')); $log->addDescription(_('Cuenta') . ": " . $accountId); $log->addDescription(_('Archivo') . ": " . $fileData['name']); $log->addDescription(_('Tipo') . ": " . $fileData['type']); $log->addDescription(_('TamaƱo') . ": " . round($fileData['size'] / 1024, 2) . " KB"); $log->writeLog(); Email::sendEmail($log); return true; } return false; }