Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 protected function init()
 {
     parent::init();
     if (!$this->source->isLocal() || $this->source->getWrapper() != 'plainfile') {
         throw new RuntimeException('The source data must be a local file stream when uploading in parallel.');
     }
     if (empty($this->options['concurrency'])) {
         throw new RuntimeException('The `concurrency` option must be specified when instantiating.');
     }
 }
Exemplo n.º 2
0
 /**
  * Perform the upload. Abort the upload if something goes wrong.
  *
  * @param AbstractTransfer $uploader
  *
  * @return bool
  */
 protected function upload(AbstractTransfer $uploader)
 {
     try {
         $uploader->upload();
     } catch (MultipartUploadException $e) {
         $uploader->abort();
         return false;
     }
     return true;
 }