# Replace file - does old file gets deleted when saving new on the same field?

**URL:** <https://community.parseplatform.org/t/replace-file-does-old-file-gets-deleted-when-saving-new-on-the-same-field/2275>\
**Category:** Cloud Code\
**Tags:** files\
**Created:** [December 9, 2021, 9:02am UTC](https://community.parseplatform.org/t/replace-file-does-old-file-gets-deleted-when-saving-new-on-the-same-field/2275 "2021-12-09T09:02:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lsmilek1](https://community.parseplatform.org/user_avatar/community.parseplatform.org/lsmilek1/32/629_2.png) [@lsmilek1](https://community.parseplatform.org/u/lsmilek1)\
**Post date:** [December 9, 2021, 9:02am UTC](https://community.parseplatform.org/t/replace-file-does-old-file-gets-deleted-when-saving-new-on-the-same-field/2275/1 "2021-12-09T09:02:40Z")

</div>

As I noticed in the dashboard, there is a “replace” option when some file is already saved in an object field. Let’s say, `FileObject` has field `file`… When I would like to update the file with new data, do I need only to save `FileObject` with a new file and the old one gets automatically deleted from storage?

My question is mainly for Cloud code javaScript, but I am curious also about ParseSwift SDK…

---

<div class="post-metadata">

**Author:** ![davimacedo](https://community.parseplatform.org/user_avatar/community.parseplatform.org/davimacedo/32/316_2.png) [@davimacedo](https://community.parseplatform.org/u/davimacedo)\
**Post date:** [December 9, 2021, 5:55pm UTC](https://community.parseplatform.org/t/replace-file-does-old-file-gets-deleted-when-saving-new-on-the-same-field/2275/2 "2021-12-09T17:55:28Z")

</div>

No. The old file is not deleted from the storage because it may being used by other objects.

---

<div class="post-metadata">

**Author:** ![lsmilek1](https://community.parseplatform.org/user_avatar/community.parseplatform.org/lsmilek1/32/629_2.png) [@lsmilek1](https://community.parseplatform.org/u/lsmilek1)\
**Post date:** [December 9, 2021, 6:28pm UTC](https://community.parseplatform.org/t/replace-file-does-old-file-gets-deleted-when-saving-new-on-the-same-field/2275/3 "2021-12-09T18:28:06Z")

</div>

Thank you for a quick response, I will build a logic for that in my app then.
