Hi I am getting image data from an XML file. The author has not provided information as to encoding or file type but I am assuming base64 and Jpg. I have the following code which does produce a file but it appears corrupt.
if (aNode <> nil) and (ANode.NodeValue <> Null) then begin //Save file FileName := TempDir + 'Preview.jpg'; DeleteFile(FileName); FileStream := TFileStream.Create(FileName, fmCreate); try //Assume node is Base64 encoded binary data base64Decoder := TIdDecoderMIME.Create(Self); try ImageData := base64Decoder.DecodeString(ANode.NodeValue) finally base64Decoder.Free; end; FileStream.Position := 0; FileStream.Write(Pointer(ImageData)^, Length(ImageData)); finally FileStream.Free; end; end I have tried changing the file extension but it does not open. I have also tried no base 64 decode but that also fails to produce a valid file. Can anyone see anything obviously wrong before I go back to the source for further information (they are in the UK so its a day turn around AND they are really unhelpful). Thanks Rob _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi@delphi.org.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: unsubscribe