/** * Pushes uploaded file into Tine shadows. * * @param array $upFileObj Associative array of uploaded $_FILE entry. * @return stdClass Ordinary Tine upload status. */ private function uploadFile(array $upFileObj) { if (empty($upFileObj['tmp_name']) || $upFileObj['error'] !== 0) { return null; // this file upload slot was not used } return json_decode(MessageUtils::uploadTempFile(TineSessionRepository::getTineSession(), file_get_contents($upFileObj['tmp_name']), $upFileObj['name'], $upFileObj['type'])); }
/** * @see ExpressoLite\Backend\Request\LiteRequest::execute */ public function execute() { $fileType = isset($_SERVER['HTTP_X_FILE_TYPE']) ? $_SERVER['HTTP_X_FILE_TYPE'] : 'text/plain'; if (isset($_SERVER['HTTP_X_FILE_NAME']) && isset($_SERVER['HTTP_X_FILE_TYPE'])) { return MessageUtils::uploadTempFile($this->tineSession, file_get_contents('php://input'), $_SERVER['HTTP_X_FILE_NAME'], $fileType); } else { return $this->httpError(400, 'Nenhum arquivo a ser carregado.'); } }