I am sending binary file as follow but not able to get the right mime type is there any unit/function
to get the mimetype from the file name
procedure TApiModule.do_dwnd(Sender: TObject; ARequest: TRequest; AResponse: TResponse; var Handled: boolean);
var
fname: string;
begin
try
fname := DATA_DIR + PathDelim + ARequest.GetNextPathInfo;
AResponse.ContentStream := TMemoryStream.Create;
(AResponse.ContentStream as TMemoryStream).LoadfromFile(fname);
AResponse.ContentLength := AResponse.ContentStream.Size;
AResponse.ContentType := 'application/octet-stream';
AResponse.SendContent;
finally
AResponse.ContentStream.Free;
end;
Handled := True;
end;