/** * Upload a file. * * <code> * $myFile = "/tmp/myfile.txt"; * * $uploader = new Prism\File\Uploader\Local(); * * $file = new Prism\File\File($myFile); * $file->setUploader($uploader); * * $file->upload(); * </code> * * @param array $file An array that comes from JInput. * @param string $destination Destination where the file is going to be saved. */ public function upload(array $file = array(), $destination = '') { if (count($file) > 0) { $this->uploader->setFile($file); } if (\JString::strlen($destination) > 0) { $this->uploader->setDestination($destination); } $this->uploader->upload(); $this->file = \JPath::clean($this->uploader->getDestination()); }
/** * Upload a file. * * <code> * $myFile = "/tmp/myfile.txt"; * * $uploader = new Prism\File\Uploader\Local(); * * $file = new Prism\File($myFile); * $file->setUploader($uploader); * * $file->upload(); * </code> * * @param array $file An array that comes from JInput. * @param string $destination Destination where the file is going to be saved. */ public function upload(array $file = array(), $destination = "") { if (!empty($file)) { $this->uploader->setFile($file); } if (!empty($destination)) { $this->uploader->setDestination($destination); } $this->uploader->upload(); $this->file = \JPath::clean($this->uploader->getDestination()); }