public function get_file($filepath, $file = '') {
        list($bucket, $uri) = $this->explode_path($filepath);
        $path = $this->prepare_file($file);
        try {
            $this->s->getObject($bucket, $uri, $path);
        } catch (S3Exception $e) {
            throw new moodle_exception(
                'errorwhilecommunicatingwith',
                'repository',
                '',
                $this->get_name(),
                $e->getMessage()
            );
        }
        return array('path' => $path);
    }
public function get_file($filepath, $file = '') {
        list($bucket, $uri) = $this->explode_path($filepath);
        $path = $this->prepare_file($file);
        try {
            $this->s->getObject($bucket, $uri, $path);
        } catch (S3Exception $e) {
            throw new moodle_exception(
                'errorwhilecommunicatingwith',
                'repository',
                '',
                $this->get_name(),
                $e->getMessage()
            );
        }
        return array('path' => $path);
    }
public function get_file ( $ filepath , $ file = '' ) { list ( $ bucket , $ uri ) = $ this -> explode_path ( $ filepath ) ; $ path = $ this -> prepare_file ( $ file ) ; try { $ this -> s -> getObject ( $ bucket , $ uri , $ path ) ; } catch ( S3Exception $ e ) { throw new moodle_exception ( 'errorwhilecommunicatingwith' , 'repository' , '' , $ this -> get_name ( ) , $ e -> getMessage ( ) ) ; } return array ( 'path' => $ path ) ; }
Download S3 files to moodle

@param string $filepath
@param string $file The file path in moodle
@return array The local stored path
Download S3 files to moodle