private function __upload($tagname,$filename,$overwrite=false) {
	
		//	if there is no uploaded file return false
		if (!is_uploaded_file($_FILES[$tagname]['tmp_name'])) {
			$this->__log(__('error encountered uploading file').'; '.__('no file was uploaded'),self::LOG_ERROR);
			Flash::set('error',__('No file was uploaded!'));
			return false;
		}
		
		//	if the uploaded file is not unique return false
		if (!$hash = $this->__unique($_FILES[$tagname]['tmp_name'])) {
			$this->__log(__('error encountered uploading file').'; '.__('the file was not unique; the file already exists'),self::LOG_ERROR );
			Flash::set('error',__('the file was not unique; the file already exists') . print_r($_FILES,1) );
			return false;
		}
		
		//	determine the uploaded file extension
		$ext = strtolower(pathinfo($_FILES[$tagname]['name'],PATHINFO_EXTENSION));
		
		//	check to make sure uploaded filetype is ok
		$valid_exts = explode(',',Plugin::getSetting('filetypes','downloads'));
		if (!in_array($ext,$valid_exts)) {
			$this->__log(__('error encountered uploading file').'; '.__('file was not an allowed type'),self::LOG_ERROR);
			Flash::set('error',__('Uploaded file not an allowed file type.'));
			return false;
		}
		
		//	setup the filename
		$filename = $this->__filename($filename,$ext);
				
		//	determine the destination directory
		$dstdir = CMS_ROOT."/{$this->settings['download_path']}/";
		
		//	if overwrite isn't allowed check to see if file exists
		if (!$overwrite && file_exists($dstdir.$filename)) {
			$this->__log(__('error encountered uploading file').'; '.__('file already exists'),self::LOG_ERROR);
			Flash::set('error',__('file already exists'));
			return false;
		}
		
		//	set the umask and move the uploaded file
		//	if there is a problem set the error, put the old file back and set an error
		umask(octdec($this->settings['umask']));
		if (!@move_uploaded_file($_FILES[$tagname]['tmp_name'],$dstdir.$filename)) {
			$this->__log(__('error encountered uploading file').'; '.__('could not move uploaded file'),self::LOG_ERROR);
			Flash::set('error',__('Could not move uploaded file!'));
			return false;
		}
		
		//	check to see if the file was uploaded and try to chmod the file
		//	if there is a problem with chmod output an error but don't stop since the
		//	file was already uploaded
		if (@!chmod($dstdir.$filename, octdec($this->settings['filemode']))) {
			$this->__log(__('error encountered uploading file').'; '.__('unable to change permissions'),self::LOG_WARNING);
			flash::set('error', __('File uploaded, however file permissions could not be changed.'));
		}
		
		//	return the image name
		$this->__log(__('uploaded file').' - '.$filename);
		return array('filename'=>$filename,'hash'=>$hash);

	}//*/