Fred Montier Posted May 10, 2023 Share Posted May 10, 2023 Is there any way to download a file without defined extension (empty, just the name) ? For some odd reason and integration to old equipment, a client is looking for this solution. That can be done in others HTTP servers. Works ok. But my client wants to use just uniGUI and not install another HTTP server just for this reason, in his cloudserver. For instance this works in my server: (Link Removed. Solved). Where "user", at the end of the URL is a text file without extension. I found: In uniGUI 'application/octet-stream' is generic name for unknown types which currently is not allowed. Look, it works with other servers. I just need to do the proper way in uniGUI. Otherwise... do some tricks. Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Fred Montier Posted May 10, 2023 Author Share Posted May 10, 2023 FYI... I know that maybe one solution is provide a stream at servermodule HTTP command. But I'm looking for a already made solution. Thanks again for any help. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 10, 2023 Share Posted May 10, 2023 Hello, You can try something like this... //uses list SysUtils, uIdCustomHTTPServer, uIdGlobal procedure TUniServerModule.UniGUIServerModuleHTTPCommand( ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo; var Handled: Boolean); begin if (ARequestInfo.Document <> '') and (SysUtils.FileExists(ExtractFilePath(ParamStr(0)) + ARequestInfo.Document)) then begin AResponseInfo.ContentType:='application/octet-stream'; AResponseInfo.ContentStream := TIdReadFileExclusiveStream.Create(ExtractFilePath(ParamStr(0)) + ARequestInfo.Document); Handled := True end; end; Quote Link to comment Share on other sites More sharing options...
Fred Montier Posted May 10, 2023 Author Share Posted May 10, 2023 Thanks.. I was thinking something similar. Works perfectly. Thanks a lot !!! Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 10, 2023 Share Posted May 10, 2023 Okay. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.