Upload a new file

@param int $appId
@param string $filename
@param string $filepath
@param array $queryParams
@return Response
497093
public function create($appId, $filename, $filepath, array $queryParams = [])
    {
        $response = $this->client->post($this->uri($appId), [
            'multipart' => [
                [
                    'name' => 'upload[file]',
                    'contents' => fopen($filepath, 'r'),
                    'filename' => $filename,
                ],
            ],
            'query' => $queryParams,
        ]);

        return $this->handleResponse($response);
    }
588358
public function addFile(string $name, string $filePath, string $contentType = 'application/octet-stream') {
        $fileName = \basename($filePath);
        $this->fields[] = [$name, new FileBody($filePath), $contentType, $fileName];
        $this->isMultipart = true;
        $this->resetCache();
    }
549038
@Override
    public boolean upload(String filePath) {
        WebLocator upload = new WebLocator(this).setTag("input").setType("file");
        return upload(upload, filePath);
    }
230842
public function getAll($appId, $scanId, array $queryParams = [])
    {
        $response = $this->api
            ->applications()
            ->scans()
            ->libraries()
            ->getAll($appId, $scanId, $queryParams);

        return new LibrariesResponse($response);
    }
1278861
public function create($appId, $scanId, $input, array $queryParams = [])
    {
        $response = $this->api
            ->applications()
            ->scans()
            ->functions()
            ->create($appId, $scanId, $input->toArray(), $queryParams);

        return new CustomFunctionResponse($response);
    }
839424
public function update($appId, $profileId, array $input, array $queryParams = [])
    {
        $response = $this->client->patch($this->uri($appId, $profileId), [
            RequestOptions::JSON => ['profile' => $input],
            'query' => $queryParams,
        ]);

        return $this->handleResponse($response);
    }
1144033
public function sendFile($filePath, $fileName = null)
    {
        if ($filePath instanceof File) {
            $filePath = $filePath->getPathname();
        }

        $response = new Response();
        $response->headers->set('Cache-Control', 'private');
        $response->headers->set('Content-Type', mime_content_type($filePath));
        $response->headers->set('Content-Disposition', 'attachment;filename="' . ($fileName ?: basename($filePath)). '"');
        $response->headers->set('Content-Length', filesize($filePath));

        $response->setContent(file_get_contents($filePath));

        return $response;
    }
329076
public function create($appId, $scanId, $issueId, CommentBuilder $input, array $queryParams = [])
    {
        $response = $this->api
            ->applications()
            ->scans()
            ->issues()
            ->comments()
            ->create($appId, $scanId, $issueId, $input->toArray(), $queryParams);

        return new CommentResponse($response);
    }
945562
public function deleteById($appId, $scanId, $libraryId, array $queryParams = [])
    {
        if (is_null($appId) || is_null($scanId) || is_null($libraryId)) {
            throw new LibException('appId, scanId, or libraryId is null');
        }

        $response = $this->client->delete($this->uri($appId, $scanId, $libraryId), [
            'query' => $queryParams,
        ]);

        return $this->handleResponse($response);
    }
55701
public function create($appId, $profileId, ControllerBuilder $input, array $queryParams = [])
    {
        $response = $this->api->applications()->profiles()->controllers()->create($appId, $profileId, $input->toArray(), $queryParams);

        return new ControllerResponse($response);
    }
1294826
public function uploadImage($filePath, $fileName = null)
    {
        $fileName === null && $fileName = pathinfo($filePath, PATHINFO_BASENAME);
        $result = $this->wechat->httpRaw(self::WECHAT_IMAGE_UPLOAD_PREFIX, [
            'media' => $this->wechat->uploadFile($filePath)
        ], [
            'access_token' => $this->wechat->getAccessToken(),
            'filename' => $fileName
        ]);
        return isset($result['errmsg']) && $result['errmsg'] == 'success' ? $result['image_url'] : false;
    }
824004
public function getById($appId, $scanId, $sourceId, array $queryParams = [])
    {
        $response = $this->api
            ->applications()
            ->scans()
            ->sources()
            ->getById($appId, $scanId, $sourceId, $queryParams);

        return new SourceResponse($response);
    }
1000168
protected function runSync($appName, $mountPath, $localPath, $up, array $options = [])
    {
        /** @var \Platformsh\Cli\Service\Shell $shell */
        $shell = $this->getService('shell');

        $sshUrl = $this->getSelectedEnvironment()
            ->getSshUrl($appName);

        $params = ['rsync', '--archive', '--compress', '--human-readable'];

        if ($this->stdErr->isVeryVerbose()) {
            $params[] = '-vv';
        } elseif (!$this->stdErr->isQuiet()) {
            $params[] = '-v';
        }

        if ($up) {
            $params[] = rtrim($localPath, '/') . '/';
            $params[] = sprintf('%s:%s', $sshUrl, $mountPath);
        } else {
            $params[] = sprintf('%s:%s/', $sshUrl, $mountPath);
            $params[] = $localPath;
        }

        if (!empty($options['delete'])) {
            $params[] = '--delete';
        }
        foreach (['exclude', 'include'] as $option) {
            if (!empty($options[$option])) {
                foreach ($options[$option] as $value) {
                    $params[] = '--' . $option . '=' . $value;
                }
            }
        }

        $start = microtime(true);
        $shell->execute($params, null, true, false, [], null);

        $this->stdErr->writeln(sprintf('  time: %ss', number_format(microtime(true) - $start, 2)), OutputInterface::VERBOSITY_NORMAL);

        if ($up) {
            $this->stdErr->writeln('The upload completed successfully.');
        } else {
            $this->stdErr->writeln('The download completed successfully.');
        }
    }
742794
public function deleteAll($appId, $scanId, array $queryParams = [])
    {
        $response = $this->client->delete($this->uri($appId, $scanId), [
            'query' => $queryParams,
        ]);

        return $this->handleResponse($response);
    }
368461
public function uploadFile(string $dirPath, string $fileName): bool
    {
        try {
            if (!$this->filesystem->createDir($dirPath)) {
                return false;
            }

            $targetFilePath = $dirPath . DIRECTORY_SEPARATOR . $fileName;

            if ($this->filesystem->has($targetFilePath)) {
                $this->addError('', "File by path `{$targetFilePath}` already exists.");

                return false;
            }

            $contentResource = $this->getFileContent();
            if ($contentResource === null) {
                return false;
            }

            return $this->filesystem->writeStream($targetFilePath, $contentResource);
        } catch (\Exception $e) {
            return false;
        }
    }
1104431
public function getById($appId, $aclId, array $queryParams = [])
    {
        $response = $this->api->applications()->acls()->getById($appId, $aclId, $queryParams);

        return new AclResponse($response);
    }
216832
public function upload(string $projectKey, string $ext, string $filename, array $params)
    {
        if (!file_exists($filename)) {
            throw new Exception\InvalidArgumentException('file '.$filename.' not found');
        }

        if (!isset($params['locale_id'])) {
            throw new Exception\InvalidArgumentException('locale_id is missing in params');
        }

        $postData = [
            ['name' => 'file', 'content' => file_get_contents($filename), 'filename' => basename($filename)],
            ['name' => 'file_format', 'content' => $ext],
            ['name' => 'locale_id', 'content' => $params['locale_id']],
        ];

        if (isset($params['update_translations'])) {
            $postData[] = ['name' => 'update_translations', 'content' => $params['update_translations']];
        }

        if (isset($params['tags'])) {
            $postData[] = ['name' => 'tags', 'content' => $params['tags']];
        }

        $response = $this->httpPostRaw(sprintf('/api/v2/projects/%s/uploads', $projectKey), $postData, [
            'Content-Type' => 'application/x-www-form-urlencoded',
        ]);

        if (!$this->hydrator) {
            return $response;
        }

        if ($response->getStatusCode() !== 200 && $response->getStatusCode() !== 201) {
            $this->handleErrors($response);
        }

        return $this->hydrator->hydrate($response, Uploaded::class);
    }