Custom Table and binary data

Yang Wen asked on August 11, 2016 20:02

I'm using a Kentico custom table as the persistence layer for my CRUD Angular app.

There is a requirement to allow user to upload images to the DB. I realize the custom table itself can not store binary blob.

How can I leverage what's provided by Kentico to upload images to the Kentico DB (Is there a centralized location where Kentico stores uploaded binary data?), and store a URL reference to it in my custom table, so it can be associated with a record? Thanks

Correct Answer

Rui Wang answered on August 11, 2016 21:14

Hi Yang

Have you considered custom Module? The class in custom module do allow you to store binary data.

Combining later replies here for easy read:

Module is good for more complex design than just a flat table. You can create relationship between classes in the module. In fact, all our applications are built as modules which give you data storage, settings, permissions and UI elements.

To get class data in custom module via REST, you need to click on the Code tab for the class to generate Info and Provider class in order for the REST to work for that new class. (Custom table had a general provider class)

0 votesVote for this answer Unmark Correct answer

Recent Answers


Yang Wen answered on August 11, 2016 21:26

I'm not experienced with the Module feature of Kentico. Guess I should read up on it.

0 votesVote for this answer Mark as a Correct answer

Rui Wang answered on August 11, 2016 22:09

Module is good for more complex design than just a flat table. You can create relationship between classes in the module. In fact, all our applications are built as modules which give you data storage, settings, permissions and UI elements.

1 votesVote for this answer Mark as a Correct answer

Yang Wen answered on August 11, 2016 22:20

It looks like tables create via custom module can also be accessed via the REST service? I'm trying to confirm via /rest/classname but not having success right now.

0 votesVote for this answer Mark as a Correct answer

Rui Wang answered on August 11, 2016 22:30

You need to click on the Code tab for the class to generate Info and Provider class in order for the REST to work for that new class. (Custom table had a general provider class)

0 votesVote for this answer Mark as a Correct answer

Yang Wen answered on August 12, 2016 02:10 (last edited on August 12, 2016 02:51)

Hmm so I got the module to work and I see how I can define a binary type for a field. However I don't think this would work. I can't do a form-data POST against some endpoint had have the file be saved into that targeted column.

I guess a better question would be, does Kentico have page that I can post to that would accept a form-data POST, and then would return some GUID of the uploaded file?

I looked at the media uploader web part, to see how it does a POST, and there is a ton of stuff in the request and probably very tight coupling

Edit: looks like I am limited to using base64 encoding and the rest api. Would be nice if whatever the media uploader control posts to, I can also post outside of the .net context.

0 votesVote for this answer Mark as a Correct answer

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