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}";
	}
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}";
	}
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}" ; }
Copies the given file to a new location.

@param MW_Media_Image_Interface $mediaFile Media object
@param unknown_type $domain Domain the image belongs to, e.g. "product", "attribute", etc.
@param string $filename Name of the new file without file extension
@throws Controller_ExtJS_Exception If the configuration is invalid or due to insufficient permissions
Copies the given file to a new location .