Announcement

Collapse
No announcement yet.

Upload an image attachment via REST Api

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Upload an image attachment via REST Api

    Hello Espo Team,

    As I understood from the forum search, it is not possible to have a custom field of type URL which in case of an image should be used as src element of the html image and shown directly.
    This is sad.

    So I have to upload the image using the REST API, if I want to programatically migrate lots of images from my current system.

    I have encoded my image in base64 and posted it. In the database table I see a new entry but file and type colums have not been set even though I provided those in the JSON.
    The other problem is that the generated primary key is not returned back, so I can not link the attachment.

    What am I doing wrong ?

    Where are the actual attachment files stored ?

    Best regards,
    Dirk

  • #2
    Attachment files are stored in the data/upload folder of the application.

    I have a similar issue, trying to use different images dynamically in templates.

    To get a better understanding of Espo's image handling I suggest that you check:

    application\Espo\Core\FileStorage\Storages\EspoUpl oadDir.php
    application\Espo\EntryPoints\Attachment.php
    application\Espo\EntryPoints\Image.php

    Good luck.
    Last edited by telecastg; 02-28-2019, 10:48 PM.

    Comment

    Working...
    X