Leveraging Kentico purely as a backend.

Yang Wen asked on April 28, 2016 21:51

We're looking at our Kentico instance as a potential backend for a mobile app.

A custom table can be used to persist form data the user submits via the app. There will also be a need to include an image with a submission. My question is regarding the persistence of the image.

Since there isn't a BLOB field type for custom tables, is Base64 encoding the image the only way to persist the image in a Kentico backend? Can Kentico's file attachment feature be leveraged in a purely backend context?

Recent Answers

Brian McKeiver answered on April 28, 2016 22:34

Yes, this is possible. We have actually done it a few times and it works well. When dealing with the images you can use the API to move images in as either attachments, media library, and/or binary in Page Types.

1 votesVote for this answer Mark as a Correct answer

Bryan Soltis answered on April 28, 2016 22:41

Hi Yang,

There are a lot fo options here. First, you can select the "File" data type on your custom table. What this will do is create a nvarchar filed on your custom table that holds a GUID for the file. The Depending on how you have your site configured, it will either upload the file to the file system, the database (into the CMS_Attachments table), or both. When it does that, it assigns it a GUID, which it then stores in the custom table field. The CMS_Attachements.AttachmentBinary field is a varbinary data type, much like a BLOB that you mentioned.

Either way, you would call the CMSPages/GetFile.aspx page to get the file, passing it the GUID so really I think it would work for your scenario either way.

This kind of setup is very similar to our MVC support in V9. In that setup, Kentico runs as the repository of data / files and everything is loaded via the API to the MVC app. I would recommend you check out the GitHub project and review how we are loading things as it may be exactly what you are looking for.


  • Bryan
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.