# Inserting an image to a field in code?

**URL:** <https://forum.servoy.com/t/inserting-an-image-to-a-field-in-code/7411>\
**Category:** Classic Servoy\
**Created:** [April 27, 2007, 1:13pm UTC](https://forum.servoy.com/t/inserting-an-image-to-a-field-in-code/7411 "2007-04-27T13:13:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![a2Pink](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@a2Pink](https://forum.servoy.com/u/a2Pink)\
**Post date:** [April 27, 2007, 1:13pm UTC](https://forum.servoy.com/t/inserting-an-image-to-a-field-in-code/7411/1 "2007-04-27T13:13:59Z")

</div>

how can we insert an image to a field in code?

That mean,  
file\_type is a coloumn data provider.

* * *

file\_type = media:///folder.png;

* * *

Is this code work?

---

<div class="post-metadata">

**Author:** ![a2Pink](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@a2Pink](https://forum.servoy.com/u/a2Pink)\
**Post date:** [April 27, 2007, 1:21pm UTC](https://forum.servoy.com/t/inserting-an-image-to-a-field-in-code/7411/2 "2007-04-27T13:21:42Z")

</div>

No, It is not Working.

How can we insert?

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [April 27, 2007, 2:20pm UTC](https://forum.servoy.com/t/inserting-an-image-to-a-field-in-code/7411/3 "2007-04-27T14:20:51Z")

</div>

You want to load an image into a field? But why would you want to load the image from Servoy’s media library then?

To load an image byte array you can use the file plugins’ readFile method. The result can be put in a field.

---

<div class="post-metadata">

**Author:** ![a2Pink](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@a2Pink](https://forum.servoy.com/u/a2Pink)\
**Post date:** [April 27, 2007, 3:16pm UTC](https://forum.servoy.com/t/inserting-an-image-to-a-field-in-code/7411/4 "2007-04-27T15:16:39Z")

</div>

If i want to load from the media i.e from repository.  
then what i will do?

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [April 27, 2007, 3:25pm UTC](https://forum.servoy.com/t/inserting-an-image-to-a-field-in-code/7411/5 "2007-04-27T15:25:36Z")

</div>

Have a look at this: [createBinaryAttachment from something stored in Media? - Classic Servoy - Servoy Community](http://forum.servoy.com/viewtopic.php?t=8219)
