First time here? You may want to check out the blog archive, subscribe to the RSS feed, sign up for free email updates, or follow me on Twitter. Thanks for visiting!

Making Files Available for Download With the DNN Text Editor 

Today it’s back to the basics. Every so often I’m being asked how to make files or documents available for download using the text editor in DotNetNuke.

First, let’s get organized. Login and go to Admin | File Manager and create a new folder under Portal Root to give your files and documents a home on the web server. Name the new folder “documents,” “downloads” or any other descriptive label you can think of.

Create a folder in DNN File Manager

Now that the “downloads” folder has been created, you can upload a document into the folder by clicking the Upload icon at the top of the File Manager. A browse box appears prompting you to locate the document on your local system. The drop-down box below the browse box contains all folders in File Manager. Make sure the “downloads” folder is selected. Then click Save File to upload the document to the web server. This may take a while depending on the size of the document.

Upload file in DNN

Back at the File Manager you may expand the Portal Root by clicking on the plus sign next to it to see the “downloads” folder. Click on the folder and locate your file in the right pane of the File Manager. Here you can copy, move, rename, and delete files.

Now that the document is up on the web server, step into a text/html module to make the file available for download. Create the link that people will click on to download your document by highlighting the link text and clicking the Insert/Edit Link button as shown below.

Create link in DNN text editor

A Link Properties window pops up. Select Browse Server and an additional Link Gallery window opens. Change the Link Type to File (A File On Your Site), select the “downloads” folder from the File Locations drop-down box and pick your document of choice from the File Name drop-down box as shown below.

DNN link properties window

Then click “Use selected link” to be returned to the Link Properties window. Just click OK here and click “Update” at the bottom of the text editor and you are done creating the link to download the document.

DNN link gallery window

A few notes. The above walkthrough is based on the FCKeditor, but even if you are using a different editor, the basic steps are the same. Also, to be on the safe side, I recommend creating PDF documents from your Microsoft Office files before making them available for download on your website. Furthermore, if you want to offer multiple files at once, “zip” them into a “package” with a free tool such as 7zip.

Feel free to add to this tutorial in the comments below.




Comments

Dan Dan says:

ah-ha!

Nice tip- I was curious about how you were doing this...

James James says:

I was aware of this approach. I'm keen to find away of having an intermediary page which records that a download has taken place. E.g. There is a download.aspx page and you pass the id of the document, then the download begins to take place. This is quite common with other sites, not sure if you can do it in DNN? This will obviously be useful for site stats.

Tom Kraak Tom Kraak says:

Here is a way to track clicks, which might be a good start.

http://www.thinkofdesign.com/Blog/tabid/65/ctl/
ArticleView/mid/369/articleId/23/
DotNetNuke-Links-and-Clicks.aspx

James James says:

Hmmm, thats a good start but I'm not sure it would give me the exact results I'm looking for. You see we've started using Google Analytics to report on website activity and this involves placing a small piece of javascript in your skin. Then every request to a DNN page sends some data to Google registering the page hit. I'm not sure if the LinkClick page would incorporate the skin and thus register the request with Google? Even if it does the information Google receives would be fairly limited.

Perhaps the solution would be to have a "Download" page built in to DNN akin to the LinkClick, Login and Register pages. When you want to link to a Download you follow a process similar to that currently used for links (within the Text/HTML module) but you actually give a Title to the download (as well as any other useful information you can think of). This information then gets stored in a Downloads database table and can be re-used throughout each individual portal. Then when a user clicks on a Download link they are taken to the built-in download.aspx which is rendered with the skin so that a hit is registered. The page will also build itself (the Title etc.) based on the info submitted by the administrator. Once the page is loaded it automatically starts the download process (popping up an "Open or Save" dialog box).

I've just made that up as I've written it so there are probably flaws in it. Hopefully you get the idea though. I am not proficient in Module creation and will not touch the source code so I'm a bit stuck unless there's something out there that does this?

P.S. I ticked "Notify me" last time but I wasn't?

Tom Kraak Tom Kraak says:

That's correct. The method that I suggested above won't be very accurate for tracking downloads as it only tracks link clicks.

Take a look at the DNN Repository project. It has a build in download counter. And I'm sure there are other modules who do this as well.

TomJack TomJack says:

The way you describe is common but requires admin rights to access the file browser. More important for my users would be to have a way for uploading files to a restricted set of directories. Any ideas?

Tom Kraak Tom Kraak says:

You as the admin could set up the folder(s) via File Manager and then give appropriate folder permissions. Then your users could upload files from within the editor.

Let me know if that makes sense.

vinod vinod says:

The control

, a new DotNetNuke control, will be introduced with this enhancement. This control will allow module developers to use a generic text editor control without knowing which provider is installed. The properties for this control are:

ChooseMode as Boolean - determines wether or not the user will have the choice between Basic Text and Rich Text Editing (like the Text/HTML core module currently has). The default is True.
ChooseRender as Boolean - determines wether or not the Text/HTML button is rendered in Basic mode. The default is True.
DefaultMode as String - will set the default mode of the control to either 'Basic' or 'Rich'. The default is 'Basic'
HTMLEncode as Boolean - determines wether the Text property will return Server.HTMLEncoded text. It also determines wether the assigning a value to the Text property will Server.HTMLDecode it on load. The default is True.
Height as System.Web.UI.WebControls.Unit - will set the height of the control.
Mode as String (ReadOnly) - returns the current mode of the control, either “B“ for Basic Text mode or “R“ for Rich Text mode.
Text as String- will be used to populate and retrieve the text/html from the control.
Width as System.Web.UI.WebControls.Unit - will set the width of the control.

Andeeeeeeeeeeee Andeeeeeeeeeeee says:

Hi....i dont have that program, can u do it in a plain html format....???

rack rack says:

For the IE Browser I use the hell out of Fidler http://wiwapia.com/en/fidler to look at all traffic going across the wire. For FireFox, you can use the FireBug plugin http://wiwapia.com/en/FireBug . There is a "Net" tab that will show you request information that is going across the wire. Most of the time you can use one of these tools to see what URL was requested in order to start a download. You can also view all the get and post information that might need to be sent in order to have your request succeed.

Name (required)

Email (will not be published) (required)

Website

Enter the code shown above:

Subscribe to our Feeds Follow on Twitter