Overwrite Upload question

8 posts, 0 answers
  1. Brian Baker
    Brian Baker avatar
    10 posts
    Member since:
    Mar 2010

    Posted 11 Jun 2010 Link to this post

    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
  2. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 17 Jun 2010 Link to this post

    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
  3. DevCraft banner
  4. Fletcher Aluminium
    Fletcher Aluminium avatar
    18 posts
    Member since:
    Jun 2010

    Posted 23 Sep 2010 Link to this post

    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
  5. Alex Fidanov
    Admin
    Alex Fidanov avatar
    636 posts

    Posted 29 Sep 2010 Link to this post

    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
  6. Fletcher Aluminium
    Fletcher Aluminium avatar
    18 posts
    Member since:
    Jun 2010

    Posted 29 Sep 2010 Link to this post

    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
  7. Alex Fidanov
    Admin
    Alex Fidanov avatar
    636 posts

    Posted 04 Oct 2010 Link to this post

    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
  8. Fletcher Aluminium
    Fletcher Aluminium avatar
    18 posts
    Member since:
    Jun 2010

    Posted 04 Oct 2010 Link to this post

    Hey Alex,

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

    Regards,



    Shaun Sharples
  9. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 05 Oct 2010 Link to this post

    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
Back to Top
DevCraft banner