# \_upload

### Parameters

#### Filedata

The data of the file being uploaded.

#### type\_id

The ID of the item this file is being uploaded to. (e.g a Job)

#### type\_enum

The type of file upload being done.

#### filename

The name of the file being uploaded

### Example

```
FM_api('File_upload',[
  'Filedata'=>'data:text/csv;base64,SWQsIkRhdGUgQ3JlYXRlZCIsIkRhdGUgQXNzaWduZWQiLCJBc3NpZ25lZCBUbyIsQ3VzdG9tZXIsU3ViamVjdCxUeXBlLCJEdWUgRGF0ZSIsRGV0YWlscyxSZXNvbHV0aW9uLFB1YmxpYy9Qcml2YXRlLFN0YXR1cywiTWludXRlcyBTcGVudCIsTm90ZXMKMzk4MDAyLCIyMDI0LTA5LTAzIDE2OjUwOjIwIiwiMjAyNC0wOS0wMyAxNjo1MDoyMCIsImFwaSB0ZXN0cyIsIkEgVGVzdCBDdXN0b21lciIsZGUsIm5ldyB0YXNrIHR5cGUiLCIyMDI0LTA5LTIwIDE3OjUwOjAxIixqdXNkLCwxLE5ldywwLAo=',
  'type_id'=>'772025',
  'type_enum'=>'3',
  'filename'=>'tasks.csv'
]);
```

### Results

#### On Success

```
{"ok":1,"id":577167,"url":"files\/3\/772025\/b315624bbf227b46521e599bb8cb15c6"}
```

#### On Failure

If the "type\_id" parameter is not set:

```
{"error":"missing or invalid parameter: type_id"}
```

If the "Filedata" parameter is not set:

```
{"error":"missing parameter: Filedata"}
```

If the file fails to upload:

```
{"error":"failed to store file"}
```


---

# 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.fieldmotion.com/fieldmotion-api-docs/file/_upload.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.
