> For the complete documentation index, see [llms.txt](https://docs.fieldmotion.com/fieldmotion-api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fieldmotion.com/fieldmotion-api-docs/user/_setimage.md).

# \_setImage

Sets the photo for a User profile.

### Parameters

#### id

The id of the user.

#### Filedata

The data of the inserted image.

#### filename

The name of the image file.

### Example

```
FM_api(
    'User_setImage',
        ['id' => '92568',
            'Filedata' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==',
        'filename' => 'red_dot.png'
        ]
    );
```

### Results:

#### On Success

```
{"ok":1}
```

#### On Failure

```
{"error":"failed to create image. please check file and upload again"}
```

Occurs when you try to upload a file that's not an image, example used here is a text file named "test.txt".
