How To upload in Multiple Location with single RadAsyncUpload

2 posts, 0 answers
  1. Jaya
    Jaya avatar
    81 posts
    Member since:
    Mar 2011

    Posted 17 Oct 2014 Link to this post


    Through Telerik's controls i found difficult to use UploadControl to work with multiple target folders 

    This is My Code I tried Like this

    Client Side Code
      <telerik:RadAsyncUpload id="Rad1" runat="server" />

     foreach (UploadedFile f in Rad1.UploadedFiles)
                        f.SaveAs(DocSLoc + f.GetName() ;

    When I try with the above code I am getting the following error

  2. Boyan Dimitrov
    Boyan Dimitrov avatar
    1728 posts

    Posted 22 Oct 2014 Link to this post


    Please try the following approach:
    //code behind
    protected void RadAsyncUpload1_FileUploaded(object sender, FileUploadedEventArgs e)
                if (e.File.GetExtension() == ".jpg")
                    e.File.SaveAs(Server.MapPath("~/App_Data/CustomFolder1/") + e.File.FileName);
                    e.File.SaveAs(Server.MapPath("~/App_Data/CustomFolder2/") + e.File.FileName);

    Please note that you do not need the foreach operation since this event will be fired for each uploaded file any way.

    Boyan Dimitrov

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. DevCraft R3 2016 release webinar banner
Back to Top