function setFilePath($path) { if (File::validClass($path)) { $this->path = $path->getFilePath(); } else { $this->path = StringBuffer::validClass($path) ? $path->toString() : $path; } }
function accept($fileobj, $dirname) { if (File::validClass($fileobj) && (StringBuffer::validClass($dirname) || is_string($dirname))) { return TRUE; } else { return FALSE; } }
function toStringBuffer($object) { if (StringBuffer::validClass($object)) { return $object; } if (isset($object) && $object != '') { if (is_object($object) && method_exists($object, 'tostring')) { return new StringBuffer($object->toString()); } else { return new StringBuffer($object); } } return NULL; }
/** * move the upload file to another location of the given parameter name * @param string|core.StringBuffer parameter name * @param string|core.StringBuffer|core.File parameter name * @return core.StringBuffer the uploaded file name * @see jphp.http.interface.IHttpRequest#moveUploadedFileTo */ function moveUploadedFileTo($key, $path) { $file = NULL; $basefile = $this->files->get($key); if (isset($basefile)) { if (File::validClass($path) || StringBuffer::validClass($path) || is_string($path)) { $targetfile = new File($path); return $basefile->moveTo($targetfile); } } return FALSE; }