/** * upload the downloadfile for a content * @param string $format * @param string $contentid * @return string xml/json */ private function contentdownloadupload($format, $contentid) { $user = $this->checkpassword(true); $this->checktrafficlimit($user); $content = addslashes($contentid); // fetch data $con = new OCSContent(); if ($con->load($content) and $con->is_owned(OCSUser::id())) { if (isset($_FILES['localfile']['name']) and isset($_FILES['localfile']['name']) and ($_FILES['localfile']['name'] != '' and $_FILES['localfile']['name'] != 'none' and $_FILES['localfile']['tmp_name'] != '' and $_FILES['localfile']['tmp_name'] != 'none')) { if ($con->downloadadd($content, 'localfile')) { $txt = $this->generatexml($format, 'ok', 100, ''); } else { $txt = $this->generatexml($format, 'failed', 101, $error); } } else { $txt = $this->generatexml($format, 'failed', 102, 'localfile not found'); } } else { $txt = $this->generatexml($format, 'failed', 103, 'no permission to change content'); } echo $txt; }