How can I set the filename for a download with TScHttpServer?
Hello,
i tried to make a small Web-Server with SecureBridge / TScHttpServer. The Code for a file-download is like this (the real code is longer):
- procedure TMyForm.ScHttpServerProcessRequest (Sender : TObject;
RequestInfo : TScHttpRequestInfo; ResponseInfo : TScHttpResponseInfo);
begin
ResponseInfo.ContentType := 'application/zip';
ResponseInfo.OutputStream := TFileStream.Create('e:\Temp\Test.zip', fmOpenRead or fmShareDenyWrite);
ResponseInfo.IsOutputStreamOwner := true;
ResponseInfo.StatusCode := scOK;
end;
Okay that works fine. When I test in Browser then Url
- https://127.0.0.1/Test.zip
the returned file has the name "Test.zip". That's okay.
But when I give more information in the URL (maybe for RESTApi):
- https://127.0.0.1/api/Token=123&File=Test.zip
then the returned file has the name "Token=123&File=Test.zip".
That's wrong. Want can I do to sent the correct filename?
I'm using Delphi 10.0.3 with SecureBridge 10.8.
Thanks in advance for any help.
Gerd Brinkmann
invent GmbH
Germany