upload documents in sharepoint 2010

Category: sharepoint 2010 general


sashidhar.ssd on Thu, 16 Dec 2010 12:28:06

Hi Friends,

          How to use the upload option the inbuilt one after seeing the page source code i Got the below link and i get the root folder as query string.

<a class="ms-addnew" id="idHomePageNewDocument" href="http://Sitename/sites/KPG/_layouts/Upload.aspx?List={F00B05E8-244F-46FA-B9D2-83C13FAD8BEA}&amp;RootFolder=%2Fsites%2FKPG%2FShared%20Documents%2FDocumentscanbedel" onclick="javascript:NewItem2(event, " target="_self" http:="" sitename="" sites="" kpg="" _layouts="">Add document</a>

My Question is how to add dynamically to the href and onclick event .

 Any help is greatly appreciated..



Mike Smith MCT MVP on Thu, 16 Dec 2010 20:26:38

I not clear on what you want to do...

If you are just asking about the JavaScript to change the "A" tag, try something like this:


var mytag = document.getElementById("idHomePageNewDocument");

mytag.href = ...

mytag.onclick = ...


sashidhar.ssd on Fri, 17 Dec 2010 04:24:50

Thanks for replying.

Actually my requirement is to show the Add NewDocument functionality in the content page.I dont want to show the ribbon control  in my design but i want to inherit the functionalities of shared documents in my allitems.aspx.Can you tell the best way to achieve it so that I can use the ascx pages.

     Thank You..

Mike Smith MCT MVP on Fri, 17 Dec 2010 05:16:49

The link and JavaScript just redirect to an upload page:



You will need to discover the GUID for your library. One way is just to click "Add New Document", or click "Upload Document" in the ribbon, to get to the upload dialog box, then right-click the dialog box and click Properties.


Is this what you need?


sashidhar.ssd on Fri, 17 Dec 2010 09:39:51

Actually i tried like that but i need it as a popup .


Tiana Arylle on Fri, 21 Dec 2012 18:19:59

I'm actually trying to do something similar: I want to add a hyperlink on a wiki page that launches the upload document functionality (as either a new tab, the same tab, or a popup - I'm not picky).

I found the hyperlink to upload documents just fine, but it's auto-opening the document after the upload, which is confusing for my users.  I'd prefer it to upload the document and just return you to the page you were previously viewing.  Is that possible?

Thanks for your help!