コード例 #1
0
ファイル: File.php プロジェクト: amanssit/slim-framework-Demo
 /**
  * Upload file (delegated to storage object)
  * @return bool
  * @throws \Upload\Exception\UploadException If file does not validate
  */
 public function upload()
 {
     if ($this->validate() === false) {
         throw new \Upload\Exception\UploadException('File validation failed');
     }
     return $this->storage->upload($this);
 }
コード例 #2
0
ファイル: File.php プロジェクト: ArmSALArmy/Banants
 /**
  * Upload file (delegated to storage object)
  * @param  string $newName Give the file it a new name
  * @return bool
  * @throws \Upload\Exception\UploadException If file does not validate
  */
 public function upload($newName = null)
 {
     if ($this->validate() === false) {
         throw new \Upload\Exception\UploadException('File validation failed');
     }
     // Update the name, leaving out the extension
     if (is_string($newName)) {
         $this->name = pathinfo($newName, PATHINFO_FILENAME);
     }
     return $this->storage->upload($this, $newName);
 }