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

Overwrite Upload question

7 Answers 69 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Brian Baker
Top achievements
Rank 1
Brian Baker asked on 11 Jun 2010, 11:35 PM
Hi, I am using the radUpload in my application.

I have the overwrite option set to false but what I really want to do is to give the user the ability to decide to overwrite it or not.when the file comes back as already existing.
 
I am unsure where the check for existence of the file is done. 

Can someone help with that?

thanks

7 Answers, 1 is accepted

Sort by
0
Valentin.Stoychev
Telerik team
answered on 17 Jun 2010, 12:59 PM
Hi Brian Baker,

this is not possible for the moment, but it is a good feature to implement it. We are logging it in our system.

Regards,
Valentin.Stoychev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Fletcher Aluminium
Top achievements
Rank 1
answered on 24 Sep 2010, 02:42 AM
Hey,

I am currently looking at being able to prompt the user to Overwrite files, now, I am not sure if this gonna work or not.  And maybe someone could suggest a workaround for it.  Any ways, this is as far as I have gotten.

           private Boolean _overwrite;
        private void radUpload1_FileUploadFailed(object sender, Telerik.Windows.Controls.FileUploadFailedEventArgs e)
        {
            if (e.ErrorMessage.ToLower().Contains("file already exists"))
            {
                e.ErrorMessage = string.Empty;
                ConfirmDialogBox dialog = new ConfirmDialogBox();
                dialog.lblText.Text = "The file " + e.SelectedFile.Name + " already exists.  Would you like to override it?";
                dialog.Closed += new EventHandler(dialog_Closed);
                dialog.Show();
            }
            else
            {
                e.ErrorMessage += Environment.NewLine + Environment.NewLine + "Please contact QuoteIt support personnel.";
            }
        }
 
        void dialog_Closed(object sender, EventArgs e)
        {
            ConfirmDialogBox dlg = sender as ConfirmDialogBox;
            if (dlg.DialogResult == true)
            {
                _overwrite = true;
                Collection<RadUploadSelectedFile> items = new Collection<RadUploadSelectedFile>();
                foreach (RadUploadSelectedFile file in radUpload1.CurrentSession.FailedFiles)
                {
                    items.Add(file);
                }
                radUpload1.CurrentSession.FailedFiles.Clear();
                //radUpload1.CurrentSession.SelectedFiles.Clear();
                radUpload1.CurrentSession.UploadedFiles.Clear();
                radUpload1.CurrentSession.ValidFiles.Clear();
                radUpload1.Items.Clear();
                foreach (RadUploadSelectedFile file in items)
                {
                    radUpload1.Items.Add(file);
                }
                radUpload1.StartUpload();
            }
        }
 
        private void radUpload1_FileUploadStarting(object sender, Telerik.Windows.Controls.FileUploadStartingEventArgs e)
        {
            if (_overwrite)
            {
                e.UploadData.OverwriteExistingFiles = true;
                _overwrite = false;
            }
        }

Technically I would have thought this would work, however, once that has been called and after I have clicked on Yes overwrite the file, there is a blank file box inside the RadUpload control container.

So if anyone has any suggestions that would be awesome.


Regards,


Shaun Sharples
0
Alex Fidanov
Telerik team
answered on 29 Sep 2010, 04:46 PM
Hi Shaun Sharples,

The reason why you are getting a blank item inside the RadUpload control is because you are adding a
RadUploadSelectedFile object into the Items collection of the RadUpload. Please note that this collection expects an RadUploadItem. What you could do is to get the items from the Items collection before clearing them and re-add them. However, when I tested this, I discovered an issue, which will still not allow you to restart the upload. We could not find a way around this right now and we are currently working on resolving this issue.


Greetings,
Alex Fidanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Fletcher Aluminium
Top achievements
Rank 1
answered on 29 Sep 2010, 07:18 PM
Hey Alex,

Oh I see.  Is this a bug of the RadUpload control that you can not add files programatically in this fashion?  Or was it never intended to be able to do it?

Regards,


Shaun
0
Alex Fidanov
Telerik team
answered on 04 Oct 2010, 04:38 PM
Hello Shaun Sharples,

This is not a bug, however there are some additional preparations that you needed to do before uploading the files. For your convenience,however, we have added a new method to the RadUpload- PrepareSelectedFilesForUpload. This method should be called after you add the new files in the SelectedItems collection, to prepare the RadUpload for starting the upload session.

The method will be available with the upcoming internal build.

Sincerely yours,
Alex Fidanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Fletcher Aluminium
Top achievements
Rank 1
answered on 04 Oct 2010, 08:35 PM
Hey Alex,

Wow, thats fantastic!  Thanks very much for that.  Is there a current time frame on the next internal build?

Regards,



Shaun Sharples
0
Vlad
Telerik team
answered on 05 Oct 2010, 07:12 AM
Hi Shaun,

 Our internal builds are every Friday. 

Kind regards,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Upload
Asked by
Brian Baker
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
Fletcher Aluminium
Top achievements
Rank 1
Alex Fidanov
Telerik team
Vlad
Telerik team
Share this question
or