Copy, replace or cancel

2 posts, 0 answers
  1. Fredrik
    Fredrik avatar
    42 posts
    Member since:
    Oct 2007

    Posted 18 Nov 2010 Link to this post


    We want to implement upload experience in our app to be similar as in Windows 7 - if any of the files already exists, the user should be able to respond to the question "Copy and replace", "Don't copy" or "Copy, but keep both files".
    As I understand it, there is currently no way to do this after the file has been uploaded. So, we could implement it this way:

    1. The user selects the files using the Telerik Upload component (as usual)
    2. The user clicks the Upload-button.
    3. Before the Upload component starts doing its' work, the app invokes a webservice, with a list of all the filenames that the user has selected to upload.
    4. The webservice returns information on which of the files already exists.
    5. The app shows the dialog for the user to decide the action (copy, don't copy, keep both) for each of the files that already exists.
    6. The list of the files in the Upload component is updated with the information from step 5, so that the upload handler knows what to do when each file has been uploaded.

    So, in theory not to complicated. But I can't see any obvious way to modify the Upload component's ordinay behaviour, i.e. intercept the click on the "Upload"-button, in order to invoke the web-service, etc.

    Any ideas? Is this at all possible?

  2. Alex Fidanov
    Alex Fidanov avatar
    636 posts

    Posted 23 Nov 2010 Link to this post

    Hi Fredrik,

    This sounds like a very good approach. If you want to alter the workflow of the RadUpload, this can be easily achieved by retemplating the control itself. Recently, we have made some changes around the RadUpload's UI. We have exposed delegate commands for all of the buttons of the RadUpload (except the Browse button). Although they are not browsable, they are public properties that you can bind to or use.
    <telerik:RadButton x:Name="UploadButton" Content="Upload" Command="{TemplateBinding UploadCommand}"...
    This way, you could retemplate the RadUpload and change the Upload button's command to a custom command, which will trigger the web-service and get the results from it. When all the checks are done, you can invoke the RadUpload.StartUpload() method to start the actual upload. Let me know if that is what you are looking for.

    Alex Fidanov
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  3. DevCraft R3 2016 release webinar banner
Back to Top