RTC Forums

Subscription => Support => Topic started by: PhilH on August 17, 2015, 03:36:54 PM



Title: TRtcHttpServer not saving files from PUT cmd in EXE dir when run as a service
Post by: PhilH on August 17, 2015, 03:36:54 PM
On the client side, I use the TRtcHttpClient component to send a file using the PUT command (I followed one of the demos to write this code). On the server side, I have the TRtcHttpServer. When the Server is run as a Form based application, it receives the files and saves them to the application's folder. When the same application is run as a service, it receives the files OK, and it saves the files to the C:\Windows\System32\LogFiles folder.

I would prefer that the service save the files to the application's EXE folder like the Form based application. Is there some way of setting a root directory on the server side?

Thanks.


Title: Re: TRtcHttpServer not saving files from PUT cmd in EXE dir when run as a service
Post by: D.Tkalcec (RTC) on August 17, 2015, 04:43:28 PM
Do NOT use relative paths (always absolute paths) in Windows Service Applications, because the deault folder for all Windows Services is Windows/System32. This has nothing to do with RTC, but is how Windows runs all Services. It is generally a good idea to use absolute paths when accessing files, to avoid this and similar problems. There is a global variable "AppFileName" in the "rtcInfo.pas" unit, which will be populated with the full path and name of the EXE being executed, so you can use ExtractFilePath(AppFileName) as a prefix to all files and folders which are relative to the location of your EXE.

Here is an example:

MyLogFiles := ExtractFilePath(AppFileName)+'LogFiles';

Best Regards,
Danijel Tkalcec


Title: Re: TRtcHttpServer not saving files from PUT cmd in EXE dir when run as a service
Post by: PhilH on August 17, 2015, 05:25:22 PM
Hi Danijel,

Thanks for information. I see where I need to edit the file name info.

Thanks,

Wes.