module/Core/src/Grid/Core/Model/FileSystem.php
public function uploaded( $temp, $to )
    {
        if ( null === $this->identity )
        {
            return false;
        }

        if ( is_array( $temp ) || is_object( $temp ) ||
             is_array( $to )   || is_object( $to ) )
        {
            if ( ( ! is_array( $temp ) && ! is_object( $temp ) ) ||
                 ( ! is_array( $to )   && ! is_object( $to ) ) )
            {
                return false;
            }

            $result = array();

            foreach ( $temp as $key => $p )
            {
                foreach ( $to as $toKey => $t )
                {
                    if ( $key == $toKey )
                    {
                        $result[$key] = $this->uploaded( $p, $t );
                    }
                }
            }

            return $result;
        }

        $to     = $this->secureFile( $this->validPath( $this->realPath( $to ) ) );
        $base   = $this->baseDir . self::UPLOADS_TEMP;
        $full   = realpath( $base . '/' . $temp );
        $toBase = $this->baseUrl . '/' . $to;
        $toFull = $this->baseDir . '/' . $toBase;

        if ( ! empty( $to ) && ! is_dir( dirname( $toFull ) ) )
        {
            $ba = '/' . basename( $to );
            $to = $this->createDir( dirname( $to ) );

            if ( ! $to )
            {
                return false;
            }

            $to     = $to . $ba;
            $toBase = $this->baseUrl . '/' . $to;
            $toFull = $this->baseDir . '/' . $toBase;
        }

        if ( is_file( $full ) && is_dir( dirname( $toFull ) ) )
        {
            if ( $this->rights( $to )->write )
            {
                if ( @ rename( $full, $toFull ) )
                {
                    return $to;
                }
            }
        }

        return false;
    }
public function uploaded( $temp, $to )
    {
        if ( null === $this->identity )
        {
            return false;
        }

        if ( is_array( $temp ) || is_object( $temp ) ||
             is_array( $to )   || is_object( $to ) )
        {
            if ( ( ! is_array( $temp ) && ! is_object( $temp ) ) ||
                 ( ! is_array( $to )   && ! is_object( $to ) ) )
            {
                return false;
            }

            $result = array();

            foreach ( $temp as $key => $p )
            {
                foreach ( $to as $toKey => $t )
                {
                    if ( $key == $toKey )
                    {
                        $result[$key] = $this->uploaded( $p, $t );
                    }
                }
            }

            return $result;
        }

        $to     = $this->secureFile( $this->validPath( $this->realPath( $to ) ) );
        $base   = $this->baseDir . self::UPLOADS_TEMP;
        $full   = realpath( $base . '/' . $temp );
        $toBase = $this->baseUrl . '/' . $to;
        $toFull = $this->baseDir . '/' . $toBase;

        if ( ! empty( $to ) && ! is_dir( dirname( $toFull ) ) )
        {
            $ba = '/' . basename( $to );
            $to = $this->createDir( dirname( $to ) );

            if ( ! $to )
            {
                return false;
            }

            $to     = $to . $ba;
            $toBase = $this->baseUrl . '/' . $to;
            $toFull = $this->baseDir . '/' . $toBase;
        }

        if ( is_file( $full ) && is_dir( dirname( $toFull ) ) )
        {
            if ( $this->rights( $to )->write )
            {
                if ( @ rename( $full, $toFull ) )
                {
                    return $to;
                }
            }
        }

        return false;
    }
public function uploaded ( $ temp , $ to ) { if ( null === $ this -> identity ) { return false ; } if ( is_array ( $ temp ) || is_object ( $ temp ) || is_array ( $ to ) || is_object ( $ to ) ) { if ( ( ! is_array ( $ temp ) && ! is_object ( $ temp ) ) || ( ! is_array ( $ to ) && ! is_object ( $ to ) ) ) { return false ; } $ result = array ( ) ; foreach ( $ temp as $ key => $ p ) { foreach ( $ to as $ toKey => $ t ) { if ( $ key == $ toKey ) { $ result [ $ key ] = $ this -> uploaded ( $ p , $ t ) ; } } } return $ result ; } $ to = $ this -> secureFile ( $ this -> validPath ( $ this -> realPath ( $ to ) ) ) ; $ base = $ this -> baseDir . self :: UPLOADS_TEMP ; $ full = realpath ( $ base . '/' . $ temp ) ; $ toBase = $ this -> baseUrl . '/' . $ to ; $ toFull = $ this -> baseDir . '/' . $ toBase ; if ( ! empty ( $ to ) && ! is_dir ( dirname ( $ toFull ) ) ) { $ ba = '/' . basename ( $ to ) ; $ to = $ this -> createDir ( dirname ( $ to ) ) ; if ( ! $ to ) { return false ; } $ to = $ to . $ ba ; $ toBase = $ this -> baseUrl . '/' . $ to ; $ toFull = $ this -> baseDir . '/' . $ toBase ; } if ( is_file ( $ full ) && is_dir ( dirname ( $ toFull ) ) ) { if ( $ this -> rights ( $ to ) -> write ) { if ( @ rename ( $ full , $ toFull ) ) { return $ to ; } } } return false ; }
Handle uploaded file

@param string|array $temp
@param string|array $to
@return bool|string failed / to
Handle uploaded file