# How to upload asset to a folder through API call

**URL:** <https://discourse.getcockpit.com/t/how-to-upload-asset-to-a-folder-through-api-call/2576>\
**Category:** Cockpit v2\
**Created:** [November 27, 2022, 2:56am UTC](https://discourse.getcockpit.com/t/how-to-upload-asset-to-a-folder-through-api-call/2576 "2022-11-27T02:56:50Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![witsec](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/witsec/32/818_2.png) [@witsec](https://discourse.getcockpit.com/u/witsec)\
**Post date:** [December 18, 2022, 1:23pm UTC](https://discourse.getcockpit.com/t/how-to-upload-asset-to-a-folder-through-api-call/2576/4 "2022-12-18T13:23:09Z")

</div>

It’s probably best to not change core files, because those will be gone when you update Cockpit to a newer version.

Instead, create a file `config/api/assets/upload.php` and put the code you wrote in there. It may need some alteration to make it work from there though.

I’m not a guru at all, I’ve only learned about these things recently: [Get list of unpublished items through API - #8 by witsec](https://discourse.getcockpit.com/t/get-list-of-unpublished-items-through-api/2609/8).

---

_[View the full topic](https://discourse.getcockpit.com/t/how-to-upload-asset-to-a-folder-through-api-call/2576)._
