# system.file.writeFile to Mounted Folder in WebDev

**URL:** <https://forum.inductiveautomation.com/t/system-file-writefile-to-mounted-folder-in-webdev/53581>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [November 30, 2021, 6:06pm UTC](https://forum.inductiveautomation.com/t/system-file-writefile-to-mounted-folder-in-webdev/53581 "2021-11-30T18:06:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![cbarker](https://avatars.discourse-cdn.com/v4/letter/c/c6cbf5/32.png) [@cbarker](https://forum.inductiveautomation.com/u/cbarker)\
**Post date:** [November 30, 2021, 6:06pm UTC](https://forum.inductiveautomation.com/t/system-file-writefile-to-mounted-folder-in-webdev/53581/1 "2021-11-30T18:06:52Z")

</div>

Hello all  
I just found WebDev and have been familiarizing myself with how it works, particularly around GET and Post commands. I am currently trying to make a post command save a passed in file to a mounted folder.

I am passing in both the byte array and file name using json passing, building the destination URL from the file name, and passing it to system.file.writeFile() with append false. No errors are thrown, and doing system.file.fileExists() on the url returns true, so something is saving, but navigating to the file location outside of ignition (using file explorer) shows an empty folder. All of this is inside a doPost python page in WebDev. The print(url) works as well

Any help is greatly appreciated  
Thank you

```auto
	data = request["data"]
	fileName = data["fname"]
	file = data["fbytes"]
	
	
	projectName = system.project.getProjectName()
	
	url = "/system/webdev/%s/Files/" %(projectName) #+ fileName
	
	system.file.writeFile(url, file, False)
	
	print( url)
	
	
	
	return {'response': fileName + " received"}

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 30, 2021, 6:18pm UTC](https://forum.inductiveautomation.com/t/system-file-writefile-to-mounted-folder-in-webdev/53581/2 "2021-11-30T18:18:37Z")

</div>

You’re conflating two things, in a way that I think is leading to some confusion.

`system.file.writeFile` is a function that doesn’t know or care about the Webdev module.  
The first parameter you give it is the location to save the file. You’re passing an intermediate URL path, not an actual filepath. The path parameter should be a fully qualified filesystem path. It probably _is_ writing somewhere, just not the location you expect.

---

<div class="post-metadata">

**Author:** ![cbarker](https://avatars.discourse-cdn.com/v4/letter/c/c6cbf5/32.png) [@cbarker](https://forum.inductiveautomation.com/u/cbarker)\
**Post date:** [November 30, 2021, 6:47pm UTC](https://forum.inductiveautomation.com/t/system-file-writefile-to-mounted-folder-in-webdev/53581/3 "2021-11-30T18:47:05Z")

</div>

Thank you for your help with that issue. I still have a problem though with writing as it now throws an IO Error

```auto
IOError: File 'C://Users/[USERNAME]/Documents/ignition_mount/DRI_Office_Streetview_01_2021-11-30_01:35:59.jpg' doesn't exist or isn't a file.

```

Shouldn’t write be putting the file there? It does not exist, that’s why I want it saved. Not including the file name results in a not a file error, so it is at least seeing the folder structure.

```auto
	data = request["data"]
	fileName = data["fname"]
	file = data["fbytes"]
	
	
	projectName = system.project.getProjectName()
	
	url = "C://Users/[USERNAME]/Documents/ignition_mount/" + fileName
	
	print( url)
	
	system.file.writeFile(url, file, False)
	
	return {'response': fileName + " received"}

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 30, 2021, 6:54pm UTC](https://forum.inductiveautomation.com/t/system-file-writefile-to-mounted-folder-in-webdev/53581/4 "2021-11-30T18:54:15Z")

</div>

The actual error returned could be a red herring (Java has limited access to OS level error codes for file operations). Do all the intermediate directories exist, besides the file in question? Does the user/account the Ignition gateway is running as actually have access to that user directory?

I suspect it’s the latter; a permissions issue masquerading as a different error; try changing (via Windows Service’s dialog) the Ignition Gateway service to run as your user as a test (requires a restart of Ignition) and attempt the write.

---

<div class="post-metadata">

**Author:** ![cbarker](https://avatars.discourse-cdn.com/v4/letter/c/c6cbf5/32.png) [@cbarker](https://forum.inductiveautomation.com/u/cbarker)\
**Post date:** [November 30, 2021, 7:16pm UTC](https://forum.inductiveautomation.com/t/system-file-writefile-to-mounted-folder-in-webdev/53581/5 "2021-11-30T19:16:56Z")

</div>

All directories exist save for the file. I changed the gateway service over to log on as “this account” with my credentials rather than “Local System Account”. I restarted the gateway service as well. Same error as before though. Ignition is running local on my machine if that helps.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [November 30, 2021, 7:19pm UTC](https://forum.inductiveautomation.com/t/system-file-writefile-to-mounted-folder-in-webdev/53581/6 "2021-11-30T19:19:55Z")

</div>

Does windows allow colons in file names?

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [November 30, 2021, 7:26pm UTC](https://forum.inductiveautomation.com/t/system-file-writefile-to-mounted-folder-in-webdev/53581/7 "2021-11-30T19:26:10Z")

</div>

colons are invalid in windows filenames

---

<div class="post-metadata">

**Author:** ![cbarker](https://avatars.discourse-cdn.com/v4/letter/c/c6cbf5/32.png) [@cbarker](https://forum.inductiveautomation.com/u/cbarker)\
**Post date:** [November 30, 2021, 7:32pm UTC](https://forum.inductiveautomation.com/t/system-file-writefile-to-mounted-folder-in-webdev/53581/8 "2021-11-30T19:32:13Z")

</div>

That was it! Thank you for all your help everyone!
