protected function prepareTemp() { $this->tempSrc = PSC::get(PSC::PATH_FILES)->sub('tmp/' . uniqid('build-phar')); /* temp verzeichnis leer anlegen */ if (!$this->tempSrc->exists()) { $this->tempSrc->make(Dir::PARENT); } else { $this->tempSrc->wipe(); } /* out datei löschen (macht nichts, wenn nicht existiert) */ $this->out->delete(); }
public function validate($data) { // die $data hier ist relativ uninteressant // wir machen hier ein bißchen dirty-action if (!isset($_FILES)) { throw new EmptyDataException('_FILES is not set, there arent any files uploaded'); } $field = $this->field; if (!array_key_exists($field, $_FILES)) { throw new EmptyDataException('_FILES[' . $field . '] is not set, file was not uploaded. Keys in _FILES: ' . implode('|', array_keys($_FILES))); } $fileArray = $_FILES[$field]; if ($fileArray['size'] <= 0) { throw new \Psc\Exception('Die größe der hochgeladenen Datei war 0.'); } $this->publicFilename = $fileArray['name']; $file = new \Webforge\Common\System\File($fileArray['tmp_name']); if ($file->exists()) { return $file; } throw new \Psc\Exception('Konnte nicht hochgeladen werden. Temporäre Datei nicht gefunden.'); }
public static function install($tpl) { if (is_array($tpl)) { $filename = array_pop($tpl) . '.html'; $dir = implode('/', $tpl); } else { $filename = $tpl . '.html'; $dir = NULL; } /* check if file exists, and copy */ $file = new \Webforge\Common\System\File(PSC::get(PSC::PATH_TPL)->append($dir), $filename); if (!$file->exists()) { $srcFile = clone $file; $srcFile->setDirectory(PSC::get(PSC::PATH_PSC_CMS_SRC)->append('psc/files/tpl/')->append($dir)); if (!$file->getDirectory()->exists()) { $file->getDirectory()->make('-p'); } $srcFile->copy($file); } }
/** * @return string */ public function getDisplayName() { return $this->file->getURL($this->getDirectory()); }