public function upload($filepath, $options = [])
    {
        if (!file_exists($filepath)) {
            throw new FilestackException("File not found", 400);
        }

        $location = 's3';
        if (array_key_exists('location', $options)) {
            $location = $options['location'];
        }

        $filename = basename($filepath);
        if (array_key_exists('filename', $options)) {
            $filename = $options['filename'];
        }

        $mimetype = mime_content_type($filepath);
        if (array_key_exists('mimetype', $options)) {
            $mimetype = $options['mimetype'];
        }

        $metadata = [
            'filepath' => $filepath,
            'filename' => $filename,
            'filesize' => filesize($filepath),
            'mimetype' => $mimetype,
            'location' => $location,
        ];

        // register job
        $upload_data = $this->upload_processor->registerUploadTask($this->api_key,
            $metadata, $this->security);

        // Intelligent Ingestion option
        if (array_key_exists('intelligent', $options) &&
            $this->upload_processor->intelligenceEnabled($upload_data)) {

            $this->upload_processor->setIntelligent($options['intelligent']);
        }

        $result = $this->upload_processor->run($this->api_key,
                                               $metadata,
                                               $upload_data);

        $filelink = $result['filelink'];

        return $filelink;
    }