Upload Overwrite Prompt

Thread is closed for posting
2 posts, 0 answers
  1. AdamL
    AdamL avatar
    41 posts
    Member since:
    Aug 2006

    Posted 08 May 2008 Link to this post

    I have not been able to find a decent solution for this issue:

    I am allowing the user to upload files from my application.  If the user attempts to upload a file that exists, I want to prompt them with the opportunity to overwrite the file or cancel the operation.

    Any suggestions?

    Thanks,

    - Adam
  2. Sophy
    Admin
    Sophy avatar
    636 posts

    Posted 10 May 2008 Link to this post

    Hi Adam,

    File existence can be validated only server-side. You can use the FileExists server event of the RadUpload control to check whether the corresponding file exists and display a message which prompts the user to choose whether to override the file or do not save it. I suggest you take a look at the FileExists help aricle for reference. However, in both cases the file will be upload to the server and the depending on the user's response the existing file will be overridden or the file will not saved.

    If you want to avoid uploading the file in case the user do not want to save it we suggest you at upload button click make an AJAX call(the files cannot be uploaded with AJAX) to the server with the selected file name and check if the file exists on the server. You can then return true/false back to the JavaScript and prompt the user to select one of the two options and depending on his response submit the whole page to upload the files or cancel the upload. Information about canceling uploading you can find in the Preventing Uploads help article.

    All the best,
    Sophy
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top