protected function _copyFile( MW_Media_Interface $mediaFile, $domain, $filename )
	{
		$config = $this->_getContext()->getConfig();

		if( ( $mediadir = $config->get( 'controller/extjs/media/default/upload/directory', null ) ) === null ) {
				throw new Controller_ExtJS_Exception( 'No media directory configured' );
		}

		$ds = DIRECTORY_SEPARATOR;
		$fileext = $this->_getFileExtension( $mediaFile->getMimetype() );
		$filepath = $mediadir . $ds . 'files' . $ds . $domain . $ds . $filename[0] . $ds . $filename[1];
		$dest = $this->_getAbsoluteDirectory( $filepath ) . $ds . $filename . $fileext;

		$mediaFile->save( $dest, $mediaFile->getMimetype() );

		$perms = $config->get( 'controller/extjs/media/default/upload/fileperms', 0664 );

		if( chmod( $dest, $perms ) === false )
		{
			$msg = sprintf( 'Changing file permissions for "%1$s" to "%1$o" failed', $dest, $perms );
			$this->_getContext()->getLogger()->log( $msg, MW_Logger_Abstract::WARN );
		}

		return "${mediadir}/files/${domain}/${filename[0]}/${filename[1]}/${filename}${fileext}";
	}