Allow for file to be saved against customer class

Adam Jackman-Moore asked on April 5, 2016 03:02

Hi All,

I have been extending the customer class and I am looking at a way to add a image file to it. The class being a system table wont allow for the file data type.

Kentico support tell me we cant use a file type. However someone has to have figured out a way of storing a file against this table. Whether it is by referencing a guid, a file path something.

On the checkout page I want them to upload a file (pdf of qualifications) so i cant see this being an unreasonable task.

Any help here appreciated.

Correct Answer

Brenden Kehren answered on April 6, 2016 14:43

So the file and other upload controls are told to upload to a specific area of the site and don't allow you to pick a specific area in the file system to upload to. So what I'd do is create or clone one of those controls and follow the similar setup BUT allow the user to enter a path in the file system to upload the files to. You might want to limit what file types are uploaded and what paths are available to the user customizing the customer object or any other object for that matter.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Roman Hutnyk answered on April 5, 2016 04:40

You should be able to upload/store file in media library and save only a URL to the file in CMS_User (or CMS_UserSettings unless there is a need to use CMS_User) table. There is Media File Uploader web part that allow uploading files, so you'll need to grab file URL from it (you might need to customize web part). If this one doesn't work I'd either implement custom control/web part or form control

1 votesVote for this answer Mark as a Correct answer

Adam Jackman-Moore answered on April 5, 2016 05:42

Yeah i really didn't want to customise anything to achieve this. I also dont want the user having access and permissions to upload their file to the media library. That is just overkill from a user UX aspect. Especially when the media libary popup appears just for a simple file.

I can add a file data type to any other type of class but not 'customer'. In fact I can enable the file data type for system tables (customer) ... Just not sue how it should work after being enabled. To be honest if the file datatype cant work with system tables why even have the option to enable it ??

My aim was to simply put an alternative form on the checkout and it would allow them to enter all their details and upload the file. Same as you can do with custom forms.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on April 5, 2016 14:15

This can be accomplished by creating your own form control to upload specifically to a "customer" directory on your site. This directory can be a simple property on the form control which is specified when you select the control for the field. It's unfortunate you "really didn't want to customise anything to achieve this", because that leaves you with what is offered out of the box, which is no functionality.

0 votesVote for this answer Mark as a Correct answer

Adam Jackman-Moore answered on April 6, 2016 02:52

Thanks Brenden, Didn't want to have to write code as it is a simple thing you would expected would be catered for out of the box, and it is a feature that already exists in Kentico. Just not for that table which i find freakin bizarre.

But thanks again I think the custom form control is my only option.

0 votesVote for this answer Mark as a Correct answer

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