You are not logged in.
Hello
How can I create a service with mormot2 to allow the client to open pdf files that are on the server in their browsers without downloading them.
Thank you
Offline
Content-Type is set to application/pdf, and Content-Disposition is set to inline, which tells the browser that the file should be opened directly in the browser rather than downloading it.
Offline
Thank you for your answer,
I am a deputant in Mormot
How can I do this
Thank you
Offline
I have this code to download
function TExampleService.DownloadFile(const FileName: RawUTF8): RawByteString;
var
FileStream: TFileStream;
begin
try
FileStream := TFileStream.Create(UTF8ToString(FileName), fmOpenRead or fmShareDenyNone);
try
SetLength(Result, FileStream.Size);
FileStream.ReadBuffer(Pointer(Result)^, FileStream.Size);
finally
FileStream.Free;
end;
except
Result := '';
end;
end;
Offline
You can refer to this example: https://github.com/synopsie/mORMot2/tre … rver-files
Offline
Thank you for your answer
Offline