# Attachment location

**URL:** https://talk.openmrs.org/t/attachment-location/32715
**Category:** Development
**Tags:** attachments
**Created:** [March 17, 2021, 12:55pm UTC](https://talk.openmrs.org/t/attachment-location/32715 "2021-03-17T12:55:49Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![pratikbiz24](https://talk.openmrs.org/user_avatar/talk.openmrs.org/pratikbiz24/32/13511_2.png) [@pratikbiz24](https://talk.openmrs.org/u/pratikbiz24)
#### Post date: [March 17, 2021, 12:55pm UTC](https://talk.openmrs.org/t/attachment-location/32715/1 "2021-03-17T12:55:50Z")

</div>

Hello everyone,

I want to know that how and where attachments are stored in openmrs.

Is the whole attachment stored in the database or only attachment’s path is stored in the database ?

So in short i want to know that is attachment stored in database or in openmrs-core directory ?

---

<div class="post-metadata">

### Author: ![herbert24](https://talk.openmrs.org/user_avatar/talk.openmrs.org/herbert24/32/8178_2.png) [@herbert24](https://talk.openmrs.org/u/herbert24)
#### Post date: [March 17, 2021, 1:02pm UTC](https://talk.openmrs.org/t/attachment-location/32715/2 "2021-03-17T13:02:04Z")

</div>

the image name is stored to the database and the image to the server,checkout

> <https://github.com/HerbertYiga/openmrs-module-attachments/blob/9c61cf896be64bb09544287a567140df387b97dd/api/src/main/java/org/openmrs/module/attachments/ComplexObsSaver.java#L79>

---

<div class="post-metadata">

### Author: ![pratikbiz24](https://talk.openmrs.org/user_avatar/talk.openmrs.org/pratikbiz24/32/13511_2.png) [@pratikbiz24](https://talk.openmrs.org/u/pratikbiz24)
#### Post date: [March 17, 2021, 1:06pm UTC](https://talk.openmrs.org/t/attachment-location/32715/3 "2021-03-17T13:06:27Z")

</div>

> [@herbert24](#):
>
> the image name is stored to the database

what is stored in the database ? Image name or Image path.

---

<div class="post-metadata">

### Author: ![herbert24](https://talk.openmrs.org/user_avatar/talk.openmrs.org/herbert24/32/8178_2.png) [@herbert24](https://talk.openmrs.org/u/herbert24)
#### Post date: [March 17, 2021, 1:10pm UTC](https://talk.openmrs.org/t/attachment-location/32715/4 "2021-03-17T13:10:43Z")

</div>

> [@herbert24](#):
>
> `getOriginalFilename()`

its the name

---

<div class="post-metadata">

### Author: ![pratikbiz24](https://talk.openmrs.org/user_avatar/talk.openmrs.org/pratikbiz24/32/13511_2.png) [@pratikbiz24](https://talk.openmrs.org/u/pratikbiz24)
#### Post date: [March 17, 2021, 1:13pm UTC](https://talk.openmrs.org/t/attachment-location/32715/5 "2021-03-17T13:13:12Z")

</div>

ok so on which basis it fetches image from the server.

On the basis of Image name ?

---

<div class="post-metadata">

### Author: ![mksd](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mksd/32/11729_2.png) [@mksd](https://talk.openmrs.org/u/mksd)
#### Post date: [March 17, 2021, 1:20pm UTC](https://talk.openmrs.org/t/attachment-location/32715/6 "2021-03-17T13:20:56Z")

</div>

@pratikbiz24 the first things to know is that an attachment is just some kind of wrapper for a [complex obs](https://wiki.openmrs.org/display/docs/Complex+Obs+Support). Complex obs are saved by default in the OpenMRS app data dir inside the `/complex_obs` subfolder.

It is the `value_complex` field of the complex obs that holds parseable string data to its location.

There is no general rule as to what’s stored in the database within the obs’ `value_complex` (image name vs image path vs whatever other locator info), that depends on the complex obs handler defined for a given complex obs.

---

<div class="post-metadata">

### Author: ![herbert24](https://talk.openmrs.org/user_avatar/talk.openmrs.org/herbert24/32/8178_2.png) [@herbert24](https://talk.openmrs.org/u/herbert24)
#### Post date: [March 17, 2021, 1:24pm UTC](https://talk.openmrs.org/t/attachment-location/32715/7 "2021-03-17T13:24:13Z")

</div>

thanks @mksd

---

<div class="post-metadata">

### Author: ![pratikbiz24](https://talk.openmrs.org/user_avatar/talk.openmrs.org/pratikbiz24/32/13511_2.png) [@pratikbiz24](https://talk.openmrs.org/u/pratikbiz24)
#### Post date: [March 17, 2021, 1:26pm UTC](https://talk.openmrs.org/t/attachment-location/32715/8 "2021-03-17T13:26:20Z")

</div>

Thanks @mksd , Now i understood how it’s working 😇.
