How to make RadAsyncUpload send files on page submit

7 posts, 0 answers
  1. Rubens
    Rubens avatar
    28 posts
    Member since:
    Mar 2008

    Posted 27 Jan 2014 Link to this post

    Hi there,

    I have a form with several fields and I need to allow our users to upload some files.
    Those files need to be stored under current entity id, i.e., I need them to be uploaded with the form itself, not before, just like old upload control did, so I could do something like this:

    var data = new MyEntity(); // it can be a new object, so I do not have an ID until I save it
    data.Title = txtTitle.Text; // and so on...
    data.Save();
     
    foreach(var file in asyncUpload.UploadedFiles)
    {
         data.Attachments.Add(file);
    }


    How can I achieve that?

    Thank you,
  2. Rubens
    Rubens avatar
    28 posts
    Member since:
    Mar 2008

    Posted 27 Jan 2014 in reply to Rubens Link to this post

    Reading other questions, I should add :

    • I can't use a temporary storage folder
    • I can't use FileUploaded event handler, as I need them on save button click event
    • I'm using SharePoint 2010 (but this doesn't seems an issue right now)

    Thanks!

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Rubens
    Rubens avatar
    28 posts
    Member since:
    Mar 2008

    Posted 27 Jan 2014 in reply to Rubens Link to this post

    Seems I was missing some modules and handlers information on web.config; for all entries I had to inform my current Telerik version (2013.3.1114.35)
  5. Andrew
    Andrew avatar
    4 posts
    Member since:
    Jan 2014

    Posted 27 Jan 2014 in reply to Rubens Link to this post

    Hi Rubens, I'm trying to get similar functionality where the files are only uploaded on page submit, and the files aren't saved to the server filesystem. I'm basically streaming the uploaded filestream into an email attachment.

    What additional config items did you have to add into the web.config? Did you need to set any specific attributes on the RadAsyncUpload control?

    Thanks!
  6. Rubens
    Rubens avatar
    28 posts
    Member since:
    Mar 2008

    Posted 27 Jan 2014 in reply to Andrew Link to this post

    I had to add:

    <modules runAllManagedModulesForAllRequests="true">
    ...
          <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule, Telerik.Web.UI, Version=2013.3.1114.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" preCondition="managedHandler" />
        </modules>
        <handlers>
    ...         <add name="ChartImage.axd_*" path="ChartImage.axd" verb="*" type="Telerik.Web.UI.ChartHttpHandler, Telerik.Web.UI, Version=2013.3.1114.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" preCondition="integratedMode" />      
                <add name="Telerik.Web.UI.SpellCheckHandler.axd_*" path="Telerik.Web.UI.SpellCheckHandler.axd" verb="*" type="Telerik.Web.UI.SpellCheckHandler, Telerik.Web.UI, Version=2013.3.1114.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" preCondition="integratedMode" />      
                <add name="Telerik.Web.UI.DialogHandler.aspx_*" path="Telerik.Web.UI.DialogHandler.aspx" verb="*" type="Telerik.Web.UI.DialogHandler, Telerik.Web.UI, Version=2013.3.1114.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" preCondition="integratedMode" />      
                <add name="Telerik.RadUploadProgressHandler.ashx_*" path="Telerik.RadUploadProgressHandler.ashx" verb="*" type="Telerik.Web.UI.Upload.RadUploadProgressHandler, Telerik.Web.UI, Version=2013.3.1114.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" preCondition="integratedMode" />      
          <add name="Telerik.Web.UI.WebResource" path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Version=2013.3.1114.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" preCondition="integratedMode" />
        </handlers>

    I have no additional attribute on RadAsyncUpload except for MultipleFileSelection="Automatic", as I currently need it.

    Good luck!
  7. Jennifer
    Jennifer avatar
    1 posts
    Member since:
    Aug 2011

    Posted 18 Feb 2014 in reply to Rubens Link to this post

    I need to do the same thing.  I want to have the files uploaded when the user click the submit button on the form.  I am a little confused by the answer in this thread though.  Rubens, all you did was add this module and it no longer did the update when the user selected the file?  Can you please exand on your solution?

    Thanks.
  8. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 18 Feb 2014 in reply to Jennifer Link to this post

    Hi Jennifer,

    I guess that you want to upload the files to TargetFolder when the user clicks the submit button. Please have a look into the sample code snippet which works fine at my end.

    ASPX:
    <telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" PostbackTriggers="RadButton1"
        MultipleFileSelection="Automatic" TargetFolder="Uploads">
    </telerik:RadAsyncUpload>
    <telerik:RadButton ID="RadButton1" runat="server" Text="Submit">
    </telerik:RadButton>

    Please elaborate your requirement if it doesn't help.
    Thanks,
    Shinu.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017