# File save limitations

**URL:** https://discourse.processing.org/t/file-save-limitations/30034
**Category:** Coding Questions
**Created:** [May 11, 2021, 7:50am UTC](https://discourse.processing.org/t/file-save-limitations/30034 "2021-05-11T07:50:26Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![geo3geo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/geo3geo/32/11881_2.png) [@geo3geo](https://discourse.processing.org/u/geo3geo)
#### Post date: [May 11, 2021, 7:50am UTC](https://discourse.processing.org/t/file-save-limitations/30034/1 "2021-05-11T07:50:26Z")

</div>

I know that for security reasons there are limitations on writing files but wonder if there any way round this.  
My objective is to read a file, add a line to it and then save it, with the same name.  
I’m using saveTable and it writes ok to my Download directory but it saves it as  
filename(1) then next time as filename(2) etc.  
Is there any way to force an overwrite rather than generate a new file each time?

---

<div class="post-metadata">

### Author: ![Pr0tonX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/pr0tonx/32/2590_2.png) [@Pr0tonX](https://discourse.processing.org/u/Pr0tonX)
#### Post date: [May 11, 2021, 8:10am UTC](https://discourse.processing.org/t/file-save-limitations/30034/2 "2021-05-11T08:10:39Z")

</div>

Hi,

there is no possibility to overwrite file from a web client because of limitations, but you can setup a local server with express (for example), and then use the fs module of Node.js to overwrite files.  
Depends on what you plan to do

---

<div class="post-metadata">

### Author: ![geo3geo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/geo3geo/32/11881_2.png) [@geo3geo](https://discourse.processing.org/u/geo3geo)
#### Post date: [May 11, 2021, 8:47am UTC](https://discourse.processing.org/t/file-save-limitations/30034/3 "2021-05-11T08:47:58Z")

</div>

What I plan to do is ‘read a file, add a line to it and then save it’.  
I don’t know anything about Node.js but yes, doing stuff server-side could be an answer. I’m more familiar with php so maybe I could

- rename myfile on server using PHP
- then let P5js saveTable as myfile  
I have my own web server so can put my PHP there.  
I know how to invoke php scripts from within html, but is it possible to invoke PHP from within P5js?

---

<div class="post-metadata">

### Author: ![Pr0tonX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/pr0tonx/32/2590_2.png) [@Pr0tonX](https://discourse.processing.org/u/Pr0tonX)
#### Post date: [May 11, 2021, 9:56am UTC](https://discourse.processing.org/t/file-save-limitations/30034/4 "2021-05-11T09:56:35Z")

</div>

You can send a post request in JS pointing to the php file which will save your file (using the axios lib or the fetch API). You’ll need to pass in arguments of your request your file.

---

<div class="post-metadata">

### Author: ![geo3geo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/geo3geo/32/11881_2.png) [@geo3geo](https://discourse.processing.org/u/geo3geo)
#### Post date: [May 11, 2021, 1:34pm UTC](https://discourse.processing.org/t/file-save-limitations/30034/5 "2021-05-11T13:34:37Z")

</div>

Thanks for reply. I’ll look at axios lib but for now I’ve got it working by doing an Ajax POST to my server side php script, which appends the new lines. So PHP is doing the file updates now not P5js.
