How to upload image in DotNetNuke(DNN) using HTML file upload control

1.1k views Asked by At

I am in the process of developing the registration module which has profile image upload functionality , I am using HTML file upload control with Web API to access database., can any one please share how to do file upload in Code behind so that the file name should be store in Files table as well as to get four re-sized image in /portals/0/user path.

2

There are 2 answers

1
Gopi.cs On

Please try to have a look at the below link -
http://www.codeproject.com/Articles/1757/File-Upload-with-ASP-NET

It just shows upload image using Asp.net code

1
Fix It Scotty On

You could use the DNNFilePicker in your module view

Limit the folder by using the ShowFolders attribute on the tag:

<%@ Register TagPrefix="dnn" Assembly="DotNetNuke.Web" Namespace="DotNetNuke.Web.UI.WebControls" %>

<dnn:DnnFilePicker runat="server" ShowFolders="false" ID="fpUserFiles" FileFilter="pdf,gif,jpg" />

In Page_Load event, set the folder:

// Limit filepath to user's folder
fpUserFiles.FilePath = FolderManager.Instance.GetUserFolder(User).FolderPath;