Files Being Overwritten

7 posts, 0 answers
  1. Ambu
    Ambu avatar
    18 posts
    Member since:
    Jan 2008

    Posted 08 Feb 2012 Link to this post

    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>

     

  2. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 09 Feb 2012 Link to this post

    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 >>
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ambu
    Ambu avatar
    18 posts
    Member since:
    Jan 2008

    Posted 09 Feb 2012 Link to this post

    спасибо.

    Is that information in any type of documentation that I could access?
  5. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 09 Feb 2012 Link to this post

    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 >>
  6. Ambu
    Ambu avatar
    18 posts
    Member since:
    Jan 2008

    Posted 09 Feb 2012 Link to this post

    I implemented the code you provided.

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



  7. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 09 Feb 2012 Link to this post

    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 >>
  8. Michael
    Michael avatar
    5 posts
    Member since:
    Feb 2012

    Posted 07 Jan 2014 Link to this post

    bump
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017