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

Files Being Overwritten

6 Answers 95 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Ambu
Top achievements
Rank 1
Ambu asked on 08 Feb 2012, 08:13 PM

I set the OverwriteExistingFiles attribute to false, but files are being overwritten any way?

Version:2010.2.817.20

Here is my code:

 

<

 

 

telerik:RadAsyncUpload runat="server" ID="AsyncUpload" Skin="Office2007" OverwriteExistingFiles="false" MultipleFileSelection="Automatic" Width="250" OnFileUploaded="RadAsyncUpload1_FileUploaded">

 

</

 

 

telerik:RadAsyncUpload>

 

6 Answers, 1 is accepted

Sort by
0
Bozhidar
Telerik team
answered on 09 Feb 2012, 01:32 PM
Hi Allan,

The developers of RadAsyncUpload decided not to implement this property on purpose. It is only available in RadUpload.

However you can use the FileUploaded server-side event to easily implement this functionality yourself. Here's how you can do that:
protected void RadAsyncUpload1_FileUploaded(object sender, FileUploadedEventArgs e)
{
    string targetFolder = "Files";
 
    string targetFileName = Path.Combine(Server.MapPath(targetFolder), e.File.GetName());
    if (!File.Exists(targetFileName))
    {
        e.File.SaveAs(targetFileName);
    }
    else
    {
        // Implement logic
    }
}

 
Regards,
Bozhidar
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Ambu
Top achievements
Rank 1
answered on 09 Feb 2012, 02:58 PM
спасибо.

Is that information in any type of documentation that I could access?
0
Bozhidar
Telerik team
answered on 09 Feb 2012, 03:15 PM
Hi Allan,

Of course, you can go to our online help, or visit our live demos to see all the functionality of our controls explained and demonstrated.
 
Regards,
Bozhidar
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Ambu
Top achievements
Rank 1
answered on 09 Feb 2012, 03:15 PM
I implemented the code you provided.

The file gets copied over even if the SaveAs function is not called.



0
Bozhidar
Telerik team
answered on 09 Feb 2012, 03:43 PM
Hello Allan,

You have to remove the TargetFolder property from the AsyncUpload. When the upload has this property set, it's going to save the file to this location on postback automatically, regardless of what you do inside the FileUploaded event.
 
Greetings,
Bozhidar
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Michael
Top achievements
Rank 1
answered on 07 Jan 2014, 06:10 AM
bump
Tags
AsyncUpload
Asked by
Ambu
Top achievements
Rank 1
Answers by
Bozhidar
Telerik team
Ambu
Top achievements
Rank 1
Michael
Top achievements
Rank 1
Share this question
or