Tuesday, August 31, 2010

How to hide "upload multiple files" links for one subsite

If we need users to input all meta data for files during the uploading, we don't want them to upload multiple files into a document library at one time.  So we have to hide the "upload multiple files" link below:


It is not easy, because "upload.aspx" is a system page which inherited from a system master page.  But there is a quick fix. We can do it through javascript.


<SCRIPT Language="Javascript">
var strCurrentUrl = window.location.pathname;
//alert(window.location.pathname);
if (strCurrentUrl.indexOf('Extranet/_layouts/Upload.aspx') >= 0)
{
                var linkElement = document.getElementById('ctl00_PlaceHolderMain_ctl01_ctl02_UploadMultipleLink');
                if (linkElement != null)
                                linkElement.style.display = "none";
}
</script>


The reason that checking "Extranet/_layouts/Upload.aspx" string in current url, is because we only want this change to be applied to one sub site "extranet".

Please be careful, this block of javascript need to be added to the end of the file.


This is what we got.

To hide the menu item, I recommend to download and deploy an excellent free third-party feature  Toolbar Manager. Unfortunately we need to configure it for all document libraries manually.


This is what we got:


0 comments:

Post a Comment