Skip to content

Instantly share code, notes, and snippets.

@luniki
Created February 14, 2011 10:25
Show Gist options
  • Save luniki/825696 to your computer and use it in GitHub Desktop.
Save luniki/825696 to your computer and use it in GitHub Desktop.
StudipDocument.php
static function createWithFile($file)
{
$doc = new StudipDocument();
if (is_uploaded_file($file)) {
// create new ID
$this->setId($this->getNewId());
$newpath = get_upload_file_path($this->getId());
// try moving uploaded file
$status = @move_uploaded_file($file, $newpath);
if (!$status) {
throw new Exception(_("Dateiübertragung gescheitert!"));
}
}
return $doc;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment