public function transport(File $file, array $config = array()) {
        $config = $config + $this->getConfig();
        $response = null;

        // If larger then 100MB, split upload into parts
        if ($file->size() >= (100 * Size::MB)) {
            $uploader = UploadBuilder::newInstance()
                ->setClient($this->getClient())
                ->setSource($file->path())
                ->setVaultName($config['vault'])
                ->setAccountId($config['accountId'] ?: '-')
                ->setPartSize(10 * Size::MB)
                ->build();

            try {
                $response = $uploader->upload();
            } catch (MultipartUploadException $e) {
                $uploader->abort();
            }

        } else {
            $response = $this->getClient()->uploadArchive(array_filter(array(
                'vaultName' => $config['vault'],
                'accountId' => $config['accountId'],
                'body' => EntityBody::factory(fopen($file->path(), 'r')),
            )));
        }

        // Return archive ID if successful
        if ($response) {
            $config['removeLocal'] && $file->delete();

            return $response->getPath('archiveId');
        }

        throw new TransportationException(sprintf('Failed to transport %s to Amazon Glacier', $file->basename()));
    }
public function transport(File $file, array $config = array()) {
        $config = $config + $this->getConfig();
        $response = null;

        // If larger then 100MB, split upload into parts
        if ($file->size() >= (100 * Size::MB)) {
            $uploader = UploadBuilder::newInstance()
                ->setClient($this->getClient())
                ->setSource($file->path())
                ->setVaultName($config['vault'])
                ->setAccountId($config['accountId'] ?: '-')
                ->setPartSize(10 * Size::MB)
                ->build();

            try {
                $response = $uploader->upload();
            } catch (MultipartUploadException $e) {
                $uploader->abort();
            }

        } else {
            $response = $this->getClient()->uploadArchive(array_filter(array(
                'vaultName' => $config['vault'],
                'accountId' => $config['accountId'],
                'body' => EntityBody::factory(fopen($file->path(), 'r')),
            )));
        }

        // Return archive ID if successful
        if ($response) {
            $config['removeLocal'] && $file->delete();

            return $response->getPath('archiveId');
        }

        throw new TransportationException(sprintf('Failed to transport %s to Amazon Glacier', $file->basename()));
    }
public function transport ( File $ file , array $ config = array ( ) ) { $ config = $ config + $ this -> getConfig ( ) ; $ response = null ; // If larger then 100MB, split upload into parts if ( $ file -> size ( ) >= ( 100 * Size :: MB ) ) { $ uploader = UploadBuilder :: newInstance ( ) -> setClient ( $ this -> getClient ( ) ) -> setSource ( $ file -> path ( ) ) -> setVaultName ( $ config [ 'vault' ] ) -> setAccountId ( $ config [ 'accountId' ] ? : '-' ) -> setPartSize ( 10 * Size :: MB ) -> build ( ) ; try { $ response = $ uploader -> upload ( ) ; } catch ( MultipartUploadException $ e ) { $ uploader -> abort ( ) ; } } else { $ response = $ this -> getClient ( ) -> uploadArchive ( array_filter ( array ( 'vaultName' => $ config [ 'vault' ] , 'accountId' => $ config [ 'accountId' ] , 'body' => EntityBody :: factory ( fopen ( $ file -> path ( ) , 'r' ) ) , ) ) ) ; } // Return archive ID if successful if ( $ response ) { $ config [ 'removeLocal' ] && $ file -> delete ( ) ; return $ response -> getPath ( 'archiveId' ) ; } throw new TransportationException ( sprintf ( 'Failed to transport %s to Amazon Glacier' , $ file -> basename ( ) ) ) ; }
Transport the file to Amazon Glacier and return the archive ID.

@uses Aws\Glacier\GlacierClient
@uses Aws\Glacier\Model\MultipartUpload\UploadBuilder
@uses Guzzle\Http\EntityBody

@param \Transit\File $file
@param array $config
@return string
@throws \Transit\Exception\TransportationException
Transport the file to Amazon Glacier and return the archive ID .