How to write a file on server folder - platform 8.1



The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Sep 18, 2012
Company:

Hello everybody,
I need to save file at server side, I mean where 1C server works.
Example below tries to save a file at client side. Is it possible to save this file in "E:\Folder" but at server? How to do it?
Platform version: 8.1.12.98
Thank you in advance for every your answer.
Kris

Code
FileName="E:\Folder\File.xml";

File = New File(FileName);
Text = New TextWriter(FileName, TextEncoding.UTF8);
X = New XMLWriter;
X.SetString("UTF-8");

...(creating XML structure)...

StrXML = X.Close();
   
Text.Write(StrXML); 
Text.Close(); 

 
#2
People who like this:0Yes/0No
Administrator
Rating: 18
Joined: Dec 4, 2017
Company:

Dear Kris,

You can specify the "&AtServer" compilation directive for your procedure or function. As a result, this piece of code will address to file resources of the computer where 1C:Enterprise server's rphost.exe process runs.

To be able to successfully access the file resources, the user on behalf of whom you run the rphost process should have appropriate rights to them.

Best regards,
Vladimir Gurov

1C Company support team
 
Subscribe
Users browsing this topic (guests: 1, registered: 1, hidden: 0)