Base64 to Binary (Delphi)

前端 未结 5 913
灰色年华
灰色年华 2021-01-03 05:47

I used Binary to Base64 function that you answered : Binary to Base64 (Delphi)

I successfully encode a file to base64 string and write it to MsSQL2008 database, but

5条回答
  •  天涯浪人
    2021-01-03 06:24

    As always, David answered sufficiently. Although I can't resist to give a slightly different solution using some of the goodies from the recent Delphi versions.

    procedure DecodeFile(const base64: AnsiString; const FileName: string);
    var
      stream: TBytesStream;
    begin
      stream := TBytesStream.Create(DecodeBase64(base64));
      try
        stream.SaveToFile(Filename);
      finally
        stream.Free;
      end;
    end;
    

提交回复
热议问题