none
How to uncheck “Add as a new version to existing files” inside the “Add a document” dialog RRS feed

  • Question

    • I am working on a publishing site collection using the enterprise wiki template. Currently when users want to insert an image inside the rich text editor,

    • And if the user insert a picture that already exists then it will replace the existing one, which might cause the picture to be displayed inside a Wiki page which it does not belong to !!


    Monday, August 28, 2017 2:36 PM

All replies

  • Hi,

    You can add the following code in your master page of this publishing site collection, the “Add as a new version to existing files” would be unchecked automatically.

    <script type="text/javascript">
    
    function DefaultUploadOverwriteOff() {
    
      if (document.title= "Upload a document" ) {
    
        var input=document.querySelectorAll("input");
    
        for (var i=input.length; i--;) {
    
          if (input[i].id.search(/\_OverwriteSingle$|\_OverwriteMultiple$/) > -1) input[i].checked=false
    
        }
    
      }
    
    }
    
    _spBodyOnLoadFunctionNames.push('DefaultUploadOverwriteOff');
    
    </script>
    

    Thanks,

    Dean Wang


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Tuesday, August 29, 2017 7:56 AM
    Moderator