# 56. Upload fotos

Upload af et foto via S3 består af 2 trin:

1. **Anmod om det forunderskrevne link for at kunne uploade direkte.**&#x20;

Som input:&#x20;

* fileExtention - jpeg ELLER jpg ELLER png,&#x20;
* farmUuid - gårdens uuid,
* fieldUuid - markens uuid,
* noteUuid - notens uuid for det direkte link til det uploadede foto,
* commentUuid - kommentarens uuid for det direkte link til det uploadede foto (valgfrit).&#x20;

Som output:

* uuid - den forventede uuid efter upload og behandling,
* farmUuid - det samme som input,
* fieldUuid - det samme som input,
* noteUuid - det samme som input,
* commentUuid - det samme som input (hvis det eksisterede),
* s3Url - den URL der bruges til at uploade fotoet,
* s3Fields - attributter der skal med i upload-formularen for fotoet.

Detaljerne om hvordan man bruger s3Url og s3Fields er beskrevet i det andet trin.&#x20;

Attributterne er kun gyldige i 60 min til upload af fotoet.

{% code overflow="wrap" lineNumbers="true" %}

```graphql
mutation generatePresignedPostPhotoData {
  generatePresignedPostPhotoData(input:{
    farmUuid: "89196056-61e5-4bce-b676-d488d611a829" 
    fieldUuid: "586a2ef2-03e4-4715-846c-07a2f0cb3016"
    noteUuid: "4a94da1c-f655-4f17-961a-4b0323e5129c"
    fileExtention: jpeg
    
  } ) {
    uuid
    noteUuid
    fieldUuid
    farmUuid
    s3Url
    s3Fields
  }
}
```

{% endcode %}

2. **Send et lokalt foto til s3Url med de foruddefinerede formularattributter fra s3Fields.**

{% code overflow="wrap" lineNumbers="true" %}

```bash
curl --location --request POST '<s3Url>' \
--form 'key="<value_in_s3Fields>"' \
--form 'AWSAccessKeyId="<value_in_s3Fields>"' \
--form 'x-amz-security-token="<value_in_s3Fields>"' \
--form 'policy="<value_in_s3Fields>"' \
--form 'signature="<value_in_s3Fields>"' \
--form 'file=@"<local_file_path>"'
```

{% endcode %}

Underretninger om behandlingen leveres via abonnements‑mekanismen beskrevet i GraphQL -> Samples -> [1. Abonnement: Hent hændelser](/geopard-tutorials/dnk/api-dokumentation/oversigt-over-geopard-api-anmodninger/1.-abonnement-hent-haendelser.md).

{% hint style="info" %}
Brug ’Accept-Encoding’:’gzip, deflate, br’.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.geopard.tech/geopard-tutorials/dnk/api-dokumentation/oversigt-over-geopard-api-anmodninger/56.-upload-fotos.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
