Forum


HomeHomePremiumPremiumDevelopmentDevelopmentfile uploading in a dnn modulefile uploading in a dnn module
Previous
 
Next
New Post
3/19/2014 9:51 AM
 

Hello,

Has anyone tried using the DnnAsyncUpload control?

I can upload files but, not to a directory of my choice.

The documentatation for the equivalent Telerik control
(http://www.telerik.com/help/aspnet-ajax/asyncupload-getting-started.html) says to use 'targetfolder' i.e.
<cc1:DnnAsyncUpload TargetFolder="uploads"   runat="server"></cc1:DnnAsyncUpload>

But that doesn't work for me.

What I would prefer to do is upload using an AJAX based call to a web service as I have other information to include. So the call would upload the file and other information at the same time, is there any way to do that?

Steve

 
New Post
3/19/2014 12:39 PM
 

Steve,

I have not used the DnnAsyncUpload control, but looking at the core code, you are correct in that it is a wrapper around the Telerik RadAsyncUpload.

According to the documentation (http://www.telerik.com/help/aspnet-ajax/upload-targetfolder.html), you should be able to use TargetFolder as a relative path to a folder where you want it to upload.  If your folder is in the Portal root, I would try using TargetFolder="~/Portals/0/uploads"


 
New Post
3/26/2014 8:40 AM
 

Hi Scott,

Thank you for your reply. After reading the documentation a little bit more thoroughly I discovered that a post back is required. I put the markup inside a user control and added a button to cause the postback. I used a server side event to save the uploaded file based on parameters that I upload with the document. 
Which is all very good, but unfortunately, there are some other issues:
1) The control causes other user controls on the Edit.ascx to reload.
2) The post back only works the first time.

I've put the relevant cut down code snippets below. 

Edit.ascx contains two controls which I've named JRACControl and MainFormUserControl. MainFormUserControl contains other user controls (not shown).

When a file is selected in the  JRACControl it causes the MainFormUserControl to reload which causes all it's controls reload as well.

Here are my questions:
1) How can I make the JRACcontrol upload a file without affecting the other controls on the page.
2) How can I make the 'upload' button continue to work after the first upload.

I would be grateful for any hints on what else to try. I assume the ajaxpanel isn't working.

Steve

**********
Edit.ascx
**********

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EditActual.ascx.cs" Inherits="MyCompanyName.Modules.FlexiContent.Edit" %>
<%@ Register Src="~/desktopmodules/FlexiContent/UserControls/MainFormUserControl.ascx" TagPrefix="dnn" TagName="MainFormUserControl" %>
<%@ Register Src="~/desktopmodules/FlexiContent/UserControls/JRACControl.ascx" TagPrefix="dnn" TagName="JRACControl" %>
<%@ Register Assembly="DotNetNuke.Web" Namespace="DotNetNuke.Web.UI.WebControls" TagPrefix="cc1" %>



       


C# code behind - works fine!
=======================
        protected void myuploadcontrol_FileUploaded(object sender, FileUploadedEventArgs e)
        {
            foreach (UploadedFile f in myuploadcontrol.UploadedFiles)
            {
//Code to save the file using the parameter supplied.
            }
        }

*************
JRAC CONTROL
*************

MARKUP
=======
   
                                            id="myuploadcontrol" 
                        OnClientFileUploaded="OnClientFileUploaded" 
                        runat="server"
                        OnFileUploaded="myuploadcontrol_FileUploaded">
                   
           
                    <%--style="visibility:hidden;width:0px;height:0px"--%>
                           
   


JAVASCRIPT - called when a file is selected. just adds a parameter to include with the post back
=========

        function OnClientFileUploaded(radAsyncUpload, args) {
            var $row = $(args.get_row());
            var inputName = radAsyncUpload.getAdditionalFieldID("ContentItemID");
            var inputType = "text";
            var inputID = inputName;
            var input = createInput(inputType, inputID, inputName);
            var label = createLabel(inputID);
            $row.append("
");
            $row.append(label);
            $row.append(input);
            $(".UploadImage").click();
        }




        function createInput(inputType, inputID, inputName) {
            var input = '';
            return input;
        }


        function createLabel(forArrt) {
            var label = '';
            return label;
        }

 
New Post
3/30/2014 3:02 AM
 

Hello,

I have given up on this. Can't get it working properly using the Telerik control.

Can anyone recommend a good JQuery plugin for uploading files? Obviously it needs to work with .Net on the server side.
If I find anything in the meantime, I will post it here.

Best Regards,

Steve

 
Previous
 
Next
HomeHomePremiumPremiumDevelopmentDevelopmentfile uploading in a dnn modulefile uploading in a dnn module



Try FREE
30 days money back guaranteed