public function upload($params, $optParams = [])
    {
        $resource = null;
        if (is_string($params) || is_resource($params)) {
            $params = ['file' => $params];
        } elseif (is_array($params) && isset($params['tmp_name'])) {
            $params = ['file' => $params['tmp_name']];
        }
        if (isset($params['file']) && is_array($params['file']) && isset($params['file']['tmp_name'])) {
            $params['file'] = $params['file']['tmp_name'];
        }
        if (isset($params['file']) && is_string($params['file'])) {
            $resource = $params['file'] = fopen($params['file'], 'r');
        }
        ArrayHelper::stringify($optParams, [
            'transformation',
        ]);

        return $this->sendRequest(['cloudId', 'file'], [
            'restAction' => 'create',
            'uri' => '/c/<cloudId>',
            'params' => $params,
            'postParams' => array_merge($params, $optParams),
        ], function ($response) use ($resource) {
            if (is_resource($resource)) {
                fclose($resource);
            }

            return isset($response->data) ? new Image($response->data) : $response;
        });
    }