--- last_review: "2026-05-07" last_reviewer: "s.kaviani" documented_code: [ ] --- ```{tags} advanced-user, how-to ``` % Issue: https://gitlab.indiscale.com/caosdb/src/linkahead-docs/-/work_items/103 # How to Update a File This guide shows how to replace the content of an existing file record with a new local file, keeping the same record and server-side path. ## Prerequisites PyLinkAhead must be installed and a connection configured. See [Setting Up PyLinkAhead](/how_to/dev_guides/pylib/README_SETUP_pylib.md) and [How to Configure PyLinkAhead](/how_to/dev_guides/pylib/configure_pylinkahead.md). ## Steps 1. Retrieve the file record of interest, for example by name: ```{literalinclude} /.assets/tests/tutorials/pylib/test_data_insertion.py :start-after: "# ---- LINK-22 ----" :end-before: "# ---- LINK-23 ----" :language: python :dedent: ``` 2. Set `file_upd.file` to the path of the new local file to upload: ```{literalinclude} /.assets/tests/tutorials/pylib/test_data_insertion.py :start-after: "# ---- LINK-23 ----" :end-before: "# ---- LINK-24 ----" :language: python :dedent: ``` `file_upd.path` holds the server-side path of the file, which stays unchanged after the update. 3. Push the update: ```{literalinclude} /.assets/tests/tutorials/pylib/test_data_insertion.py :start-after: "# ---- LINK-24 ----" :end-before: "# ---- LINK-25 ----" :language: python :dedent: ```