Main > Forum > 1C:Enterprise Platform > 1C:Enterprise – Business applications platform > How to write a file on server folder - platform 8.1

Forum

Search UsersRules
How to write a file on server folder - platform 8.1
#1
Active user
Points:: 0
Joined:: Sep 18, 2012

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(); 

Profile
#2
Interested
Points:: 0
Joined:: Dec 4, 2017

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

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.