从流数据获知文件类型
function StreamGetFileType(aStream:TStream):String; var Buffer:Word; begin Result := ''; aStream.Position := 0; if aStream.Size=0 then exit; aStream.ReadBuffer(Buffer,2); case Buffer of $4D42:Result := 'bmp'; $D8FF:Result := 'jpeg'; $4947:Result := 'gifp'; $050A:Result :='pcx'; $5089:Result :='png'; $4238:Result :='psd'; $A659:Result :='ras'; $DA01:Result :='sgi'; $4949:Result :='tiff'; end; end;