API
Version 7.x > API > Using Kentico's file uploader in a custom webpart View modes: 
User avatar
Member
Member
Conrad - 1/16/2013 6:48:54 PM
   
Using Kentico's file uploader in a custom webpart
I would like to use the DirectUploaderControl in a custom web part but there is little to no documentation on how to do such a thing. I understand this may not be part of the API but I would like some insight on how to register and setup DirectUploadControl.ascx in another custom .ascx file.
I've contained the control in a cms:BasicForm but I don't what to do after that to make it show up, to upload a file or edit the file/node passed to the control.
If someone could give me detail instructions on how to integrate this control, it would be truly appreciated.

The control is found in ~\Kentico\CMSFormControls\Basic\DirectUploadControl.ascx
An example of how I would like to use it would be:
In CMSDesk, the content tab, you can edit documents that have been uploaded.
When a document is selected one of the tabs is "Form". This is the form I would like to use.

User avatar
Member
Member
Conrad - 1/18/2013 11:22:12 AM
   
RE:Using Kentico's file uploader in a custom webpart
I decided to use \Kentico\CMSModules\Content\CMSDesk\New\NewFile.aspx as an example to base this control on. I found out that the control I want to use and learn how to setup is the DirectUploader, in /CMSModules/Content/Controls/Attachments/DocumentAttachments/DirectUploader.ascx. All I need to know now is how to set the document to be updated in the control. I have the node I want to edit but I don't know how to make the control use that specific node.

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 2/8/2013 9:20:38 AM
   
RE:Using Kentico's file uploader in a custom webpart
Hi,

Generally, you need to have a DocumentID (as the uploader works with particular document, not with node). Then you can set the DocumentID property of the control.
The DirectUploader internally uses the DirectFileUploader:
                // Add update control
// Dynamically load uploader control
DirectFileUploader dfuElem = Page.LoadUserControl("~/CMSModules/Content/Controls/Attachments/DirectFileUploader/DirectFileUploader.ascx") as DirectFileUploader;

You also need to set it's InsertMode property to false to make the control use the update mode to allow overwriting the previous (existing) file version.

Should you need any additional details, please feel free to ask.

Regards,
Zdenek