locked
Remove "Upload Multiple Files" from upload page RRS feed

  • Question

  • Hi,

    Is there any way I can remove the link "Upload multiple files" on the Upload.aspx? I thought of customizing the Upload.aspx of my document library (Forms/Upload.aspx) but it looks like instead of using that particular file, sharepoint always redirects to another file Upload.aspx in the 12 hive. I am able to customize it in my development machine, but since it is affecting all document libraries, I cannot proceed in this direction. My requirement is to remove it just from one document library.

    Whatever I do, I have to use only SPD and JavaScript. No custom code is allowed for me.

    Recently heard of SPServices jQuery library for sharepoint. Does anybody got any idea how to create a custom aspx page through which I can upload a document to a library?

    Thank you,

    Arun

     

     

     


    - Loka Samastha Sukhino Bhavanthu : May Eternal Peace & Goodwill Prevail in the Whole World!
    • Moved by Mike Walsh FIN Wednesday, March 24, 2010 12:53 PM customization q (and SPD questions apart from wf go here too) (From:SharePoint - Development and Programming (pre-SharePoint 2010))
    Wednesday, March 24, 2010 12:48 PM

Answers

  • Hi,

    This is what I've come up with... works ok for me (tested with IE only sorry)

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    
    <script type="text/javascript">
    
    $(document).ready(function(){ 
      $("ie\\:menuitem[text='Upload Multiple Documents']").each(function(){
        this.hidden=true;
      });
    
      var newClick = '';
      
    //menu item
      $("ie\\:menuitem[text='Upload Document']").each(function(){
    
        newClick = $(this).attr('onMenuClick').replace('Upload.aspx', 'UploadX.aspx')
        $(this).attr('onMenuClick', newClick);
    
      });
    
    //top-level 'upload' button
      $("a[accesskey='U']").each(function(){
         var par = $(this).parent().get(0);
    
         $(par).attr('onclick', '').bind('click', new Function(newClick));
    
      });
    
    });
    
    </script>
    
    

     

     

    Paul.

    • Proposed as answer by Hydroraven Friday, July 16, 2010 2:38 PM
    • Marked as answer by Mike Walsh FIN Friday, July 16, 2010 4:21 PM
    Thursday, July 15, 2010 8:45 AM

All replies

  • see this post.. the last anser can help you to achive your goal

    http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/faa8f59f-eb4b-425e-8b6c-4247c1e105c0

    menu name for upload multiple items is 'MultipleUpload'


    Regards, Vikas Patel.

    Wednesday, March 24, 2010 12:54 PM
  • In adition to Vikas Patel reply, you can try this also  using javscript

    http://www.c-sharpcorner.com/UploadFile/sharepointholic/SharePointCustomizationTricks101192009140559PM/SharePointCustomizationTricks1.aspx


    Ashish Kanoongo, MCP, MCSD, MCTS
    Wednesday, March 24, 2010 1:25 PM
  • @Vikas Patel: forgive me if I'm wrong, but the question clearly states that the solution must not use custom code, which is exactly what the link you provide does.

    @Arun,

    Try this. On your upload page for the particular document library add a content editor web part and edit the source code. Add the following to remove the multiple upload menu item

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    
    <script type="text/javascript">
    
    $(document).ready(function(){ 
       $("ie\\:menuitem[text='Upload Multiple Documents']").each(function(){
           this.hidden=true;
       });
    });
    
    </script>

     

    Paul.

     

    Wednesday, March 24, 2010 3:39 PM
  • see this post.. the last anser can help you to achive your goal

    Hi Vikas,

    Thanks for the input. But I cannot use custom code to achieve this goal.

    -Arun


    - Loka Samastha Sukhino Bhavanthu : May Eternal Peace & Goodwill Prevail in the Whole World!
    • Edited by Mike Walsh FIN Friday, July 16, 2010 4:20 PM Don't use full quote. Waste of screen space
    Wednesday, March 24, 2010 4:41 PM
  • In adition to Vikas Patel reply, you can try this also  using javscript


    Hi Ashish,

    Thanks for the reply. Actually I am not looking for a solution to remove tool bar button. My problem is the link "Upload Multiple documents" link on the Upload.aspx page, just below the file selection control.

    -Arun


    - Loka Samastha Sukhino Bhavanthu : May Eternal Peace & Goodwill Prevail in the Whole World!
    • Edited by Mike Walsh FIN Friday, July 16, 2010 4:20 PM Don't use full quote. Waste of screen space
    Wednesday, March 24, 2010 4:43 PM
  • Hi Paul,

    Thanks for the reply.

    Your solution is to modify the Upload.aspx file of my document library, right?

    I tried to custmize it (not with jQuery, but with plain JavaScript links object) but the problem is this particular file is never used by sharepoint. Instead always it gets redirected to another file with the same name Upload.aspx located at 12/Templates/Layouts. By modifying this 12 hive file, I am able to remove the "Upload Multiple Documents" link but this affects all the other document libraries. hence I cannt modify the file in my 12 hive .

    Two things are really confusing here:

    1. Why there is a upload.aspx at <doclibname>/Forms/ and another one at 12/templates/layouts ?
    2. It seems the document library copy of upload.aspx is identical to 12 hive copy, then why SharePoint is redirecting it to 12 hive page?

    Thank you,

    -Arun


    - Loka Samastha Sukhino Bhavanthu : May Eternal Peace & Goodwill Prevail in the Whole World!
    Wednesday, March 24, 2010 5:03 PM
  • Sorry Arun, I had to run off and didn't get to finish my reply. I've only given you half a solution so far!

    Firstly, what I've done is given you a way to remove the Upload Multiple Documents menu item from the Upload menu on the toolbar (You will put the content editor web part on each view page. The solution is not for upload.aspx but for AllItems.aspx etc)

    You are right about the upload.aspx. A document library will always redirect you to /_layouts/Upload.aspx regardless of whether there is an upload.aspx form in the /forms folder of the library.

    There is a post about that here if you are interested. http://hristopavlov.wordpress.com/2009/02/17/understanding-sharepoint-list-forms/ It kind of explains it.

    Now since you don't wish to edit the original upload.aspx in the 12 hive because it affects all document libraries, take a copy of it and call it UploadX.aspx for example. Keep it in the 12/TEMPLATES/LAYOUTS folder.

    Make the changes to uploadx.aspx in order to remove the multiple upload link.

    Now we will edit the script in the content editor web part to ensure that the Upload Document menu item points to the new uploadx.aspx, instead of the old upload.aspx.

    The full jQuery for this is

    <script type="text/javascript">
    
    $(document).ready(function(){ 
       $("ie\\:menuitem[text='Upload Multiple Documents']").each(function(){
           this.hidden=true;
       });
    
       $("ie\\:menuitem[text='Upload Document']").each(function(){
    
           $(this).attr('onMenuClick', $(this).attr('onMenuClick').replace('Upload.aspx', 'UploadX.aspx'));
    
       });
    
    });
    
    </script>

     

    Hope that helps!

     

     

    Wednesday, March 24, 2010 6:01 PM
  • Hi Paul,

     

    Actually I was looking for a solution to make my custom upload.aspx a part of my site itself. Now it looks like the file *should* be there in the 12 hive, right?

    Since my current deployment strategy doesn't allow me to touch the 12 hive, I have to take it to the client to get an approval.

    Tough job! :)

    Thanks again Paul,

    -Arun

     


    - Loka Samastha Sukhino Bhavanthu : May Eternal Peace & Goodwill Prevail in the Whole World!
    Thursday, March 25, 2010 3:38 AM
  • No problem Arun,

    I did do some playing around with it, I tried to upload the custom uploadx.aspx page to the forms folder of the document library, but it doesn't work. Once it is in the forms library the file becomes 'customized' (unghosted) and files that are supposed to be /layouts pages can't be customized like that.

    There may be a way around that, but i think it would involve jumping through a number of hoops to get it working.

    Thursday, March 25, 2010 1:40 PM
  • OK.....

    I spent a few days trying to get my head around this.  I wanted to have an upload page that only allowed the uploading of one doc at a time, no multiples and no overwriting.  There are alot of posts on this but they all end without a real solution that I could actually complete.  I combined a couple of bits here and there and got what I wanted.

    Browse down in the 12 hive dir with notepad (to avoid the crazy ~ ____ that sharepoint developer messes with) make a copy of upload.aspx - I called mine upload1.aspx.

    TO GREY OUT THE UPLOAD MULTIPLE FILES... LINK:

    Find this line:

    <asp:HyperLink id="UploadMultipleLink" runat="server"  ACCESSKEY=U Text="<%$SPHtmlEncodedResources:wss,upload_document_upload_multiple%>" onclick="javascript:return !LaunchPictureLibraryApp();"/>

    ADD THIS TO IT: enabled="false" so that the line looks like this:

    <asp:HyperLink id="UploadMultipleLink" enabled="false" runat="server"  ACCESSKEY=U Text="<%$SPHtmlEncodedResources:wss,upload_document_upload_multiple%>" onclick="javascript:return !LaunchPictureLibraryApp();"/>

    TO GET RID OF THE OVERWRITE EXISTING FILES CHECKBOX:

    Find this line:

    <asp:CheckBox id="OverwriteSingle" Checked="true" Text="<%$Resources:wss,upload_document_overwrite_file%>" runat="server" /></TD></TR></TABLE>

    ADD THIS TO IT:  Visible="false" so it looks like this:

    <asp:CheckBox id="OverwriteSingle" Checked="true" Visible="false" Text="<%$Resources:wss,upload_document_overwrite_file%>" runat="server" /></TD></TR></TABLE>

    This gets rid of these features.  I got around the whole menu thing by just providing a link to the upload1.aspx page (along with the LIST ID of the list I'm posting to) directly to those using it I assume though that you might be able to make a list use this upload page from the menu but thats another issue - one that I don't need to figure out.

    I AM SO SMART!  S-M-R-T!

    Btw this is Rick's favourite employee John....

     

     

     

     

    Wednesday, June 23, 2010 4:20 PM
  • Paul solution worked for me. Iam able to remove upload multiple files link and also able to redirect the user to custom UploadX.aspx page

    But

    when I click on top level upload menu on the libary toolbar it is still taking me to old upoload.aspx page

    I tried adding below to your script


       $("ie\\:menu[text='Upload']").each(function(){

           $(this).attr('onMenuClick', $(this).attr('onMenuClick').replace('Upload.aspx', 'UploadX.aspx'));

       });


    but It's not working, I'm missing somethinh here ?

     

    Tuesday, July 6, 2010 2:55 PM
  • Hi Vaishali,

    Good question. The top level Upload button on the toolbar is an <A> tag, so the jQuery for that will be different. I'll take a look and see if I can find a solution.

    Paul.

    Tuesday, July 6, 2010 9:50 PM
  • Hello Paul,

    I came accross this post and it was exactly what I needed to address a similar situation.  I was wondering if you had any luck with changing the top level Upload button to use the new uploadx.aspx file in Layouts?

    Thanks, Jeff

    Wednesday, July 14, 2010 4:44 PM
  • Hi,

    This is what I've come up with... works ok for me (tested with IE only sorry)

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    
    <script type="text/javascript">
    
    $(document).ready(function(){ 
      $("ie\\:menuitem[text='Upload Multiple Documents']").each(function(){
        this.hidden=true;
      });
    
      var newClick = '';
      
    //menu item
      $("ie\\:menuitem[text='Upload Document']").each(function(){
    
        newClick = $(this).attr('onMenuClick').replace('Upload.aspx', 'UploadX.aspx')
        $(this).attr('onMenuClick', newClick);
    
      });
    
    //top-level 'upload' button
      $("a[accesskey='U']").each(function(){
         var par = $(this).parent().get(0);
    
         $(par).attr('onclick', '').bind('click', new Function(newClick));
    
      });
    
    });
    
    </script>
    
    

     

     

    Paul.

    • Proposed as answer by Hydroraven Friday, July 16, 2010 2:38 PM
    • Marked as answer by Mike Walsh FIN Friday, July 16, 2010 4:21 PM
    Thursday, July 15, 2010 8:45 AM
  • Thanks for that solution, Paul!  That's exactly what I needed to remove the multiple uploads function for a specific doc library!
    Thursday, July 15, 2010 6:44 PM
  • Thanks Paul, that worked perfectly and my users are happy!

     

    Thanks, Jeff

    Friday, July 16, 2010 2:38 PM
  • Thanks a lot for working on my request, I will try this out !!
    Tuesday, August 17, 2010 6:34 PM
  • I am using this to hide the single file upload menu item. working perfectly. The code supplied makes the Top level "Upload" button do nothing which is OK but I would like to change the top level Upload button to call the multiple file upload page. any help appreciated

     

     

    Tuesday, February 15, 2011 3:24 PM