I want to change an uploaded filename if it already exist

2 posts, 0 answers
  1. Fred
    Fred avatar
    53 posts
    Member since:
    Aug 2011

    Posted 03 Nov 2011 Link to this post

    In fileexplorer there is the abilty to upload files. Right now if I upload a file that has the same name as an existing file I get a prompt that tells me the file already exist. What I want to do is give the newfile a unique name and save it. For example I upload file named "Fred.txt" if "Fred.txt" already exist I will try "Fred-01.txt, Fred-02.txt, Fred-03.txt..." until I find one that doesnt exist then save the file with that name. How?


    <telerik:RadFileExplorer ID="RadFileExplorer1" runat="server" OnClientItemSelected="OnImageSelected" EnableCopy="true" EnableAsyncUpload="true" >

    <Configuration MaxUploadFileSize="20480000" />


  2. Dobromir
    Dobromir avatar
    1633 posts

    Posted 04 Nov 2011 Link to this post

    Hi Fred,

    To achieve this you need to override the StoreFile() method of RadFileExplorer's content provider. Please take a look at the following help article for more detailed information on how the content provider works:
    Using custom FileBrowserContentProvider

    Also, a similar example is available in the following KB article:
    Giving the uploaded files unique names

    Best wishes,
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top