Example #1
0
 /**
  * @param $fileLocator ein string wie er aus listFiles herauskommt
  * @param File $destination der Ort an den die Datei kopiert werden soll
  */
 public function extractFile($fileLocator, WebforgeFile $destination)
 {
     $tmp = Dir::createTemporary();
     $this->exec('x', array('y'), escapeshellarg($fileLocator) . ' ' . escapeshellarg($tmp));
     // suche $file im $tmp verzeichnis
     $file = File::createFromURL($fileLocator, $tmp);
     if (!$file->exists()) {
         throw new Exception(sprintf("Entpacken hat zwar geklappt, aber die Datei '%s' kann nicht in '%s' (temporary) gefunden werden.", (string) $fileLocator, $tmp));
     }
     $file->copy($destination);
     $tmp->delete();
     return $this;
 }