This is a migrated thread and some comments may be shown as answers.

How To upload in Multiple Location with single RadAsyncUpload

1 Answer 24 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Jaya
Top achievements
Rank 1
Jaya asked on 17 Oct 2014, 11:09 AM

Hi

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
E:\MyApp\App_Data\RadUploadTemp\1413543533059HomeError.jpg 



1 Answer, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 22 Oct 2014, 10:11 AM
Hello,

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);
            }
            else
            {
                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.



Regards,
Boyan Dimitrov
Telerik
 

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.

 
Tags
AsyncUpload
Asked by
Jaya
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or