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

Copy, replace or cancel

1 Answer 71 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Mikael
Top achievements
Rank 1
Mikael asked on 18 Nov 2010, 08:31 PM
Hi!

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?

Thanks!
/Fredrik

1 Answer, 1 is accepted

Sort by
0
Alex Fidanov
Telerik team
answered on 23 Nov 2010, 12:52 PM
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.

Greetings,
Alex Fidanov
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
Upload
Asked by
Mikael
Top achievements
Rank 1
Answers by
Alex Fidanov
Telerik team
Share this question
or