[Solved] Missing "CR" when download file from fpweb embedded server lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- eolandro · 2022-10-14 01:04 Hi! I have a simple webserver for download files. it use TFPWebModule but when i download a binary file some chars are stripped ("CR"  => '\r'). My DataModuleRequest have code like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i if ARequest.URI = '/down' then   begin     AResponse.ContentType:= 'application/octet-stream';     AResponse.Contents.LoadFromFile(AReque st.ContentFields.Values['FL']);   end;                           i have tested with curl and python. but all "CR" are missing i changed my code to: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i if ARequest.URI = '/down' then   begin     AResponse.ContentType:= 'application/octet-stream';     MS := TMemoryStream.Create;     MS.LoadFromFile(ARequest.ContentFields.Values['FL']);     AResponse.ContentStream.CopyFrom(MS,MS.Size);   end;                         But does not work. Any suggestions? PD. sorry for bad english. ---------------------------------------------------------------------- Leledumbo · 2022-10-17 16:49 TResponse.Contents is a TStrings descendant. It uses OS native line ending by default. TResponse has another property, ContentStream, which can be used for binary transfer. So use that instead. ---------------------------------------------------------------------- eolandro · 2022-10-21 18:28 Yes, thanks so much! Now this code works Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i if ARequest.URI = '/down' then   begin     AResponse.ContentType:= 'application/octet-stream';     MS := TMemoryStream.Create;     MS.LoadFromFile(ARequest.ContentFields.Values['FL']);     AResponse.ContentStream := MS;   end;