Add ‘Upload a Document’ button to another site

In SharePoint 2013 by rhodzyLeave a Comment

​This button comes from the Document Centre template.

Add an html form webpart and add this

<script type="text/javascript">// <![CDATA[
var navBarHelpOverrideKey = "wssmain";
function OpenNewFormUrl(url)
{
var options = {};
SP.SOD.executeFunc('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', function() {
SP.UI.ModalDialog.commonModalDialogOpen(url, options, null, null);
});
}
// ]]>
</script>

<div class="ms-uploadbtnlink"><button onclick="javascript:OpenNewFormUrl(&#39;/doclist/Forms/upload.aspx&#39;);return false;" type="submit"><nobr><img alt="Upload a Document" src="/_layouts/Images/uploaddoc.png"/>&#160;<span>Upload a Document</span></nobr></button> </div>