Bootstrap images


Hello everyone,

I just imported the "Locations" app into my environment and I'm using the Country entity on my testApp (all fine here).

Now, what I would like to do is to mass import an image (flag) for each country. 

For that, I have created a new entity named CountryPicture with the following attributes:

  • Id (Country Identifier)
  • Content (Binary Data)
  • Filename (Text)
  • Filetype (Text)

I have an Excel file with the same structure(in the content column I have the fullpath+filename). Can I bootstrap this into the CountryPicture entitiy? If so, how do I convert the fullpath+filename into binary data?

Perhaps i'm confusing the concepts, but thats what I understood from this answer. If someone could guide me I would appreciate it.

Hi Hugo,

Are you build a web or mobile application?

On both you will need to have access to the binary of the picture in order to save it on CountryPicture.Content (Binary Data) attribute.

Either you get the binary via the URL or via the filepath (filesystems directory path) depending where you have your images stored, another option is to have the binary stored directly on the excel on base64 string.

So if you have your pictures stored and access to them via filesystem on mobile you would make use of the File plugin GetFileData:

On a web application you can achieve that using FileSystem forge component:

Hope it helps you!

Best regards.

Thanks for the answer Daniel but I think I need some more help.

I have all the images stored on a file system folder (D:\dev\flags)

And here is a copy of the Entities on my Web Application:

So how can I use File_ReadBinary to read the content of each image and write it to the CountryPicture Entity using the Country Id attribute? I have already the FileSystem component on my web application.

Look at the Excel file attached where I got the Id's of the Country Entity (from the Locations App) and also the filepath, filename and filetype. I think I'm confused with all the concepts and from what I have read in other posts so if you could give me some more guidance I would really appreciate it.


Hi Hugo,

Please check Documentation and the following post:

Previous post is very illustrative, and I hope that helps you to figure it out. 

Please check Employee Services forge component:

EmployeesSampleData eSpace you have also a lot of examples that will show you how to achieve that, take specially attention to SampleData_BootstrapEmployeePictures (action).

In that case they load the photos from a .Zip file that is on the eSpace as Resource, you might want to consider that approach, would be simpler than access to fileshare location (considering that you would need also to set the permissions to that folder accordingly).

Basically on your excel you need the to hold the Country code, that you will need to get the respective CountryId, and you get the Binary invoking the File_ReadBinary.

Best regards.