RTC Forums
November 01, 2024, 01:31:50 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: TRtcHttpServer not saving files from PUT cmd in EXE dir when run as a service  (Read 4332 times)
PhilH
Newbie
*
Posts: 3


« 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.
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 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
Logged
PhilH
Newbie
*
Posts: 3


« Reply #2 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.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.022 seconds with 16 queries.