コード例 #1
0
ファイル: ParallelTransfer.php プロジェクト: vobinh/PHP
 /**
  * {@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.');
     }
 }
コード例 #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;
 }