I am working with SharePoint 2019 on prem. On one of the pages, I have content search web part added which shows documents results from a library as a search solution. On the same page, I am looking to add a button/link on the click of which, I would like to open up Document library upload form like below.

enter image description here

So basically just want to make sure that user can upload the files from the same page using this, not sure if its doable from JS perspective.

Can someone help please.

Thanks in advance.

1 Answer 1


What you are seeing is an iframe, so go check the url that is being displayed. Most probably it is something along the lines of https://my.sharepoint.com/path/to/site/_layouts/15/Upload.aspx?List=%7B[id-of.list]%7D&RootFolder=%2Fsome%2Fpath then you know "what" to show.

As to how: Use SP.UI.ModalDialog.showModalDialog

So, most probably you need to execute something like (warning! untested!)

SP.SOD.executeFunc('sp.ui.js', 'SP.UI.ModalDialog', function(){
  var url = _spPageContextInfo.webServerRelativeUrl.replace(/\/?$/, '/'+_spPageContextInfo.layoutsUrl) + '/Upload.aspx?List=%7B[id-of-the-list]%7D';
    title: "do upload",
    width: 800,
    height: 400,
    url: url
  • its not working
    – mdevm
    Commented Jun 28, 2019 at 18:44
  • What have you tried? What was the result?
    – Nils
    Commented Jun 28, 2019 at 21:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.