download() public method

Download a file from the given $url and save it to $toPath with $filename. If $filename is null then we just use the name from the $url
public download ( string $url, string $toPath, string $filename ) : string
$url string
$toPath string
$filename string
return string
Beispiel #1
0
 /**
  * Fire events when you see this job has been
  * called back
  *
  * @param $output
  * @param $storagePath
  * @return void
  */
 public function handle($output, $storagePath)
 {
     switch ($output['state']) {
         case 'finished':
             $filename = $output['label'];
             $fromUrl = $output['url'];
             $file = $this->FileDownloader->download($fromUrl, $storagePath, $filename);
             $this->Event->fire('devise.encoding.zencoder.finished', [$file, $output]);
             break;
         default:
             $this->Event->fire('devise.encoding.zencoder.error', [$output]);
             break;
     }
 }