1
votes

I am creating modules using the template created by Chris Hammond (TYVM Chris).
My modules have a few things that can be edited by the user in the settings area, one of them being an image.

I can use a TextBox and have the user type the root relative path to the image, but it is a little clunky because the user has to upload the image in the file management area of the website, get the path, then add it to the module settings. It would be a lot smoother if I could have a Image selector that would tie into the DNN files and allow the user to select an image that has been previously uploaded to DNN or add their own.

How would one accomplish this?

2

2 Answers

2
votes

I suggest you to use the FilePickerUploader control of DNN.
You could see what it looks like in the Portal Settings (in Admin menu). It's used for the selection of the logo file, background image and favicon.

For example, it could be use like this:

<%@ Register TagPrefix="dnn" TagName="FilePickerUploader" Src="~/controls/filepickeruploader.ascx" %>
<dnn:FilePickerUploader ID="ctlFavIcon" runat="server" Required="True" FileFilter="ico" />

Required and FileFilter attributes are optionnal and I think it provides other options.

0
votes

Just use a DNNEditor webcontrol

<%@ Register TagPrefix="dnn" Assembly="DotNetNuke.Web" Namespace="DotNetNuke.Web.UI.WebControls" %>
<dnn:DnnEditor ToolsFile="xmfile.xml"/>

Via this control you can use the default image selector. In first place you will see a lot of selectors in the toolbar, but you can change this via a xml file and add that xml file to the property ToolsFile

Just let me know if you need more help.