Custom Table altenate form, "Upload File" form control?

Tom Wisneski asked on July 7, 2020 16:49

Question: Is there a out-of-the-box form control for Custom Table alternative forms, for "Upload File"? Kentico Forms (bizforms/online forms) has the option when you select Data Type > File, of a Upload File control. Custom tables does have under Data Type of text, a form control of File Selection. However this is for the selection of a Kentico file (and not something a user would upload from their own location / pc). Are there any options with this, or is this something that needs to be done custom? Thanks in advance!

Correct Answer

Dmitry Bastron answered on July 10, 2020 19:08

Tom, thanks, this is a very helpful explanation.

I think in your situation I'd consider these 2 options then:

  • develop custom Form Control for string or GUID field in your custom table that:
    • when user selects the file, will upload the file via Ajax call to your custom API straight away (before submitting the form)
    • API processing these Ajax calls will save a file to some folder in Media Libraries using MediaFileInfoProvider and return GUID of just saved media file
    • in the custom table you can save this GUID (as GUID or string) and retrieve your file when needed via this GUID
  • migrate Custom Tables to Module Custom Classes
    • this should not take long as APIs for both and data structures are very similar, it will be more a matter of copying over the data from one SQL table to another
    • Module Custom Classes have alternative forms as well
    • It is possible to create a field of type "Binary" in Custom Class where you can store your file content, but will require creating a Form Control for uploading this data as well
0 votesVote for this answer Unmark Correct answer

Recent Answers


Dmitry Bastron answered on July 7, 2020 18:44

Hi Tom,

It depends on your use case for this field. If this is something when your CMS users would need to upload and store, you can use Media Selection control which allows selecting files from the media library and uploading files there as well. In this case, it will be a string field with URL to the media file.

But if you are going to present this form on a frontend of your website somehow I think this is not going to be a good idea. For this, it is better to use bizforms.

0 votesVote for this answer Mark as a Correct answer

Tom Wisneski answered on July 7, 2020 20:32

Dmitry...Thanks. You have helped me with answers before, and it is always appreciated (thank you). Anyways, it seems that other times I am on a Form (bizform), and it would be better suited for a Custom Table control. Now that this project is all Custom Tables - then the better option for this need was a bizform table. I will have to figure this out in some work around. Custom Tables and the use of their alternate forms is what this project is built on. If anything comes to mind, please post another response. Thanks. Tom

0 votesVote for this answer Mark as a Correct answer

Dmitry Bastron answered on July 7, 2020 22:53

Tom, I understand your confusion, it's ok, we've all been there. It is important to understand what is the best fit for each feature. Let me give you a hint.

Basically, there are a few ways of storing custom table data in Kentico (as SQL tables):

  1. Custom Tables
  2. Module Custom Classes
  3. Page Types (and pages in the CMS tree)
  4. Forms (bizforms)

First three options should be used for content or something like that. When this data is populated by CMS admin or synchronized (imported) from third-party systems. It could be custom dictionaries, pages, products, locations, etc. To learn more when you should be using each option I'd recommend reading Sean G. Wright's blog post where he is explaining this in detail.

The last one, Forms (also called bizforms), is purely designed to store data captured on the frontend of the website. Something like contact us, register for event, sign up for newsletter, product enquiry form.

So, all in all, if you describe in more detail what you actually need to store or what the function is, it will be easier to help you because as you can see there is no golden standard of storing the data and all depends on your case. I hope it makes more sense now.

0 votesVote for this answer Mark as a Correct answer

Tom Wisneski answered on July 9, 2020 15:06

Dmitry,good information (thanks). This is a project that has been very successful for our company, we built it form scratch using Kentico as the CMS. It is a Leads Management process. So sales dealers, sales leads and admins (all depending on roles). That they can manage perspective sales leads from initial contact through quotes, and finally a given sale. The table structure we built it on is Custom tables. Tables includes a general Leads table, a History log table. Also, a table for dealers and sales leads, as well as tables to manage stored filters that the searching can be done in the leads on the client view portion (browser). Anyways, All the forms pointing and funneling the data into the "Leads" custom table have been alternate forms built on the same table. This project with success has grown exponentially, and we are always asked for new additions to it. The upload for sales reps on the "Lead" creation or update details forms (screens), is the latest. So I have used bizforms for much prior work --- you actually helped me out with calculators (and Brenden another MVP always said I should be using custom tables). Well anyways, for this scenario custom tables was the correct way to go. However, this is just one new add-on item that does not fit the Kentico options. I will need to figure out something custom for this need. Anyways, thanks again.

0 votesVote for this answer Mark as a Correct answer

Tom Wisneski answered on July 13, 2020 21:33

Dmitry -- Thanks for the 2nd reply back (sorry, I did not see it to today). This looks promising, and I will work through it. Rather than keep posting back and forth on the question queue (especially after marking a reply correct). Is there an option in which I can reach out to contact you. Thanks.

0 votesVote for this answer Mark as a Correct answer

Dmitry Bastron answered on July 13, 2020 22:50 (last edited on July 13, 2020 22:51)

Sure thing! There is a Slack community channel I can send you an invite, there are lots of Kentico developers as well other MVPs. Feel free to drop your email address here or in my Twitter or Linkedin (can find in my profile here) direct messages and I'll send you the invite.

0 votesVote for this answer Mark as a Correct answer

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