Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Hello, is there any possibility to read files from network drives?
try {
print(readFileAsString("\\\\10.170.84.24\\Standard\\ProE_standard\\Relace\\Relace PRT.txt"));
} catch (e) {
print("FAILED: " + e);
}
I need to read fresh relations so all models actual relations. The only one place in our company provides relations is network drive.
Solved! Go to Solution.
You followed this settings:
Not sure, but web based apps have no access to file folders, make sure to add the config path.
Result of using provided code:
Do you have web_link_file_read config option set to yes?
Yes, I do and it works if I read from 😧 or C: drives. But when i reach out to network drive it can't read a thing
@ilyachaban wrote:
Yes, I do and it works if I read from 😧 or C: drives. But when i reach out to network drive it can't read a thing
It probably has to be a mapped drive.
I've tried 3 ways to call the drive. One of them was mapped drive, second one was ip adress, and third one UNC path. Nothing worked. But if i use local 😧 or C: drive it reads file fine.
Did you also tried without the.blank character, here
„Replace PRT.txt“ with „Replace_PRT.txt“
try {
print(readFileAsString("\\\\10.170.84.24\\Standard\\ProE_standard\\Relace\\Relace_PRT.txt"));
} catch (e) {
print("FAILED: " + e);
}
Or replace the IP by the hostname, or copy the file to a local one or change the directory first.
Is readFileAsString Unicode?
Renaming file doesn't do anything due to reading same file but from C: or 😧 drive works without problem
Does network drive counts as local????
You followed this settings:
Not sure, but web based apps have no access to file folders, make sure to add the config path.
IT WORKED. Thank you so much.
P.S.
I want the PTC community to understand just how close I am to swearing in this thread.
I’ve spent two weeks on what should be a basic task: reading a file from disk. The blocker is a config file that has no documentation—not even the basics. There’s no reference for its syntax, no list of options, no explanation of what it controls or how it’s supposed to be used. Just… nothing.
