Solved

Create an "Upload a Document" button web part in other document libaries

Posted on 2013-01-15
3
2,682 Views
Last Modified: 2013-01-17
1. Created a subsite and used the "Document Center" template.
2. Exported the "Upload a Document" button from that site.
3. Uploaded the button web part to the Web Part Library.
4. On the Home page I added the "Upload a Button" web part.
5. The button works on the subsite fine.
6. On the home page the button will not open the "upload.aspx" page.

Here is a copy of the code for the button. They are exactly the same for both the home page and subsite.

<div class="ms-uploadbtnlink"><button onclick="javascript:OpenNewFormUrl(&#39;DropOffLibrary/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>
0
Comment
Question by:mnoisette
3 Comments
 
LVL 11

Expert Comment

by:Guru Ji
Comment Utility
You just have to specify the entire path for the form URL for upload.aspx in the home page.
For instance your website URL is

myintranet/home

and your subsite is

myintranet/departments/IT

then currently your upload for subsite pointing to
myintranet/departments/IT/DropOffLibrary/Forms/upload.aspx

you have to give FULL path on the code above
so that it knows which department or subsite library you trying to upload too.

Currently the URL is translated to

myintranet/DropOffLibrary/Forms/upload.aspx

and thats why it does not work
0
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 500 total points
Comment Utility
Hi,
this is because the function "OpenNewFormUrl" is only defined on the doc center page (and not on the root site home page).

Thats the function in the doc center:
function OpenNewFormUrl(url)
{
	var options = {width:720, height:480};
	SP.UI.ModalDialog.commonModalDialogOpen(url, options, null, null);
}

Open in new window


Either you add the function to your home page or you recode the button click:
<button onclick="javascript:var options = {width:720, height:480};SP.UI.ModalDialog.commonModalDialogOpen('/DropOffLibrary/Forms/upload.aspx', options, null, null);return false;" type="submit">

Open in new window


Please be sure and check the Url of the DropOffLibrary.

HTH
Rainer
0
 

Author Closing Comment

by:mnoisette
Comment Utility
Worked like a charm!
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

There is one common problem that all we SharePoint developers share: custom solution deployment. This topic can't be covered fully in this short article, so all I want to do in this one is to review it from a development-to-operations perspectiv…
SharePoint Designer 2010 has tools and commands to do everything that can be done with web parts in the browser, and then some – except uploading a web part straight into a page that is edited in SPD. So, can it be done? Scenario For a recent pr…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now