Avoiding the “Add a listing” page when uploading documents to the Portal


This is certainly a frequently asked question (in fact I’m writing this as I just had it asked via the blog here).

The basic gist of the problem is this. When you “Upload a document” within a portal area you are presented not only with the “Upload Document” page below:

Upload Document

But immediately after it the “Add Listing” page below:

Add Listing

The reason for this is that by default the “Add a listing for this document” is checked (see first diagram). Unfortunately there is no way to change this default without some customisation, so below I present two possible solutions. Remember this IS a customisation, and therefore all the standard disclaimers apply. (I’m actually working on a post that sets out some customisation common sense, but in the meantime, you know what they are!)

The start is common to both approaches, and that is to ensure you are modifying the correct “Upload.aspx” file, there is actually one for each template. To help identify which template you should modify I’m going to refer to my earlier post here:
http://blogs.msdn.com/danielmcpherson/archive/2004/05/23/139886.aspx 

Specifically, the section that desribes which template each of the folders under:
Local_Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\TEMPLATE\<Locale ID>\
relate to.

Once you have found and opened the correct “Upload.aspx” file chose one of the following two approaches:

1. Remove the “Add a listing for this document” control from the Upload.aspx page.
This approach basically involves removing the Server control responsible for rendering the Checkbox, to do this follow the below steps:

a) Search the file for the following string:
<SPSWC:SubmitLinkOnSTSUploadDocPage runat=server />

b) Delete it.

c) Save and exit notepad.

Done. From here on the “Upload a document” page with no longer have the “Add a listing for this document” and therefore will not display the corresponding web page.

No add listing

2. Set the default checkbox value to unchecked.
This approach involves adding some javascript that flips the value client side when the page loads.

a) Find the following tags at the bottom of Upload.aspx:
</BODY>
</HTML>

b) Insert the following immediately above them:
<script language=’javascript’ for=’window’ event=’onload’>
  document.all.submitlst.checked=false; 
</script>

c) Save and exit notepad.

Done. Now the checkbox will default to unchecked.

Unchecked

A final note, if either of these approaches don’t work, then it may be because you have modified the “Upload.aspx” page previously in FrontPage, it has therefore become “unghosted”. If this is the case you should make the above changes using FrontPage instead of notepad as I described.

I suspect there are many other options out there, so share away folks, it’s what the comments are for!

Comments (7)

  1. Tad says:

    I know this is unrelated to the post, but is there anyway in a "Document Library" to have the folders displayed before the files?

    For example, mine are always displayed as

    Example Document #1

    Example Document #2

    Example Document #3

    Example Folder #1

    Example Folder #2

    And I’d much prefer to have them sorted in the Windows "default" order…

    Example Folder #1

    Example Folder #2

    Example Document #1

    Example Document #2

    Example Document #3

    I’ve played around with a bunch of options in the views and just can’t seem to figure it out. Am I missing something extemely obvious?

  2. Jason Medero says:

    Great tip Daniel I was just looking into doing this small customization when I found this post. You need to come over to the East Coast and have some type of developer training class!

  3. Hi Jason,

    The East Coast? You mean like Dover? <grin>

    Daniel

  4. Hi Tad,

    <grin> Quite a tanget you have drawn there, not sure off top of my head, would have to take a look. Send me a comment so I have it in my inbox.

    Daniel

  5. Mike Drips says:

    This is a great solution that worked for my current client requirements. I don’t know if I am more knowledgeable or puzzled everytime I delve into the innards of SharePoint, but as long as everything works (and this solution does, as I have throughly tested it) who cares?