public function requestServerFile($uri, $fileCode, $expectedHash, $postData = [])
    {
        $filePath = $this->getFilePath($fileCode);

        $result = Http::post($this->createServerUrl($uri), function ($http) use ($postData, $filePath) {
            $this->applyHttpAttributes($http, $postData);
            $http->toFile($filePath);
        });

        if ($result->code != 200) {
            throw new ApplicationException(File::get($filePath));
        }

        if (md5_file($filePath) != $expectedHash) {
            @unlink($filePath);
            throw new ApplicationException(Lang::get('system::lang.server.file_corrupt'));
        }
    }
public function requestServerFile($uri, $fileCode, $expectedHash, $postData = [])
    {
        $filePath = $this->getFilePath($fileCode);

        $result = Http::post($this->createServerUrl($uri), function ($http) use ($postData, $filePath) {
            $this->applyHttpAttributes($http, $postData);
            $http->toFile($filePath);
        });

        if ($result->code != 200) {
            throw new ApplicationException(File::get($filePath));
        }

        if (md5_file($filePath) != $expectedHash) {
            @unlink($filePath);
            throw new ApplicationException(Lang::get('system::lang.server.file_corrupt'));
        }
    }
public function requestServerFile ( $ uri , $ fileCode , $ expectedHash , $ postData = [ ] ) { $ filePath = $ this -> getFilePath ( $ fileCode ) ; $ result = Http :: post ( $ this -> createServerUrl ( $ uri ) , function ( $ http ) use ( $ postData , $ filePath ) { $ this -> applyHttpAttributes ( $ http , $ postData ) ; $ http -> toFile ( $ filePath ) ; } ) ; if ( $ result -> code != 200 ) { throw new ApplicationException ( File :: get ( $ filePath ) ) ; } if ( md5_file ( $ filePath ) != $ expectedHash ) { @ unlink ( $ filePath ) ; throw new ApplicationException ( Lang :: get ( 'system::lang.server.file_corrupt' ) ) ; } }
Downloads a file from the update server.
@param  string $uri          Gateway API URI
@param  string $fileCode     A unique code for saving the file.
@param  string $expectedHash The expected file hash of the file.
@param  array  $postData     Extra post data
@return void
Downloads a file from the update server .