This project is read-only.

File Upload Web Part

SharePoint extranets / portals are a great way to provide B2B collaboration with partners, customers, or vendors. Some documents should only be submitted, and need to be secure. Use the File Upload Web Part for users to submit (and only submit) documents. Users do not know where the documents will end up (site owners specify a list of destinations), nor do they need access to the destination. Dynamic filename building supports timestamps, usernames, and more. Full auditing data (creator username and timestamp) is maintained.


  • One or more SharePoint Document Libraries
    • Link to each Document Library will be entered into the second column in the SharePoint List below
  • SharePoint List with 3 columns, each single line text
    • First column contains the text shown in the drop down list in the web part
    • Second column contains URL link to corresponding Document Library
    • Third column contains format string for the uploaded file name when it is stored in the Document Library. The following are the supported string replacements and formatting:
      • {user:name:X} with SPUser.Name where X is a standard string format
      • {user:email:X} with SPUser.Email where X is a standard string format
      • {datetime:X} where X is a standard datetime format (supported by C#)
      • {filename:X} where X is a standard string format



The following shows the two (2) File Upload Web Parts on a page. The user will
*Select a location in the drop down list
*Use Browse button to locate the file to upload
*Click the Submit button to perform the upload


Document Library

The following shows the folders in the Document Library used to hold the uploaded files.


SharePoint List

The following shows the rows/values in the SharePoint List used by the File Upload Web Part.



The following shows a file that has been uploaded into one of the Document Libraries.



The following shows the Configuration of a File Upload Web Part:

Configuration Items

  • Appearance Section
    • Title
      • This is the Title that appears on the screen above the File Upload Web Part
  • Configuration Section
    • Configuration List Name
      • This is the name of the SharePoint List that holds the informaton for the File Upload Web Part
    • Title Field
      • This is the field name in the SharePoint List that contains the text shown in the drop down list.
    • Destination URL Field
      • This is the field name in the SharePoint List that contains the URL of the Document Library folder to hold the uploaded file.
    • Filename Format Field
      • This is the field name in the SharePoint List that contains the format mask for the name of the file after it has been uploaded to the Document Library.

Deploying the solution

Download the SharePoint solution file (.wsp).
Use PowerShell or STSADM to install the solution into the farm.
Use PowerShell, STSADM, or Central Administration to deploy the solution.

Building the solution

The File Upload Web Part solution is a Visual Studio 2010 solution with a single SharePoint project using C#.
You will need Visual Studio 2010 installed. To use SharePoint project templates, Visual Studio requires that SharePoint be installed locally. SharePoint 2010 can be installed on Windows 7 (though I personally don't recommend it), or on Windows Server 2003 or above.
Upon opening the solution, configure the URL for deployment by opening the Properties window (tab) for the Project, and adjusting the Site URL. This address is used any time you use the Deploy command.

Last edited Feb 2, 2012 at 4:24 AM by KCallisDev, version 10


TaffyLewis Apr 3, 2013 at 8:30 PM 
Could not get this to work! :(

TaffyLewis Apr 3, 2013 at 8:18 PM 
Examples are so much more better!