Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > AsyncUpload > Files Being Overwritten

Not answered Files Being Overwritten

Feed from this thread
  • Allan avatar

    Posted on Feb 8, 2012 (permalink)

    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>

     

    Reply

  • Bozhidar Bozhidar admin's avatar

    Posted on Feb 9, 2012 (permalink)

    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 >>

    Reply

  • Allan avatar

    Posted on Feb 9, 2012 (permalink)

    спасибо.

    Is that information in any type of documentation that I could access?

    Reply

  • Bozhidar Bozhidar admin's avatar

    Posted on Feb 9, 2012 (permalink)

    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 >>

    Reply

  • Allan avatar

    Posted on Feb 9, 2012 (permalink)

    I implemented the code you provided.

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



    Reply

  • Bozhidar Bozhidar admin's avatar

    Posted on Feb 9, 2012 (permalink)

    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 >>

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > AsyncUpload > Files Being Overwritten
Related resources for "Files Being Overwritten"

ASP.NET AsyncUpload Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  |  Step-by-step Tutorial  ]