A departure from my normal post…I usually try to stick to only posting solutions to weird situations I run into, or recommendations from real world experiences, or the occasional post on community or work activities. Not this time. This post technically falls into the first category (solution to a weird situation), but is really a cry for help.

Problem DefinitionThe problem is having a document library that is missing the Upload.aspx form, which should be associated to the SPList.DefaultNewFormUrl property of the library. There are a few different ways to get there. I ran into it because of a web template I built that was missing the creation of the Upload.aspx file, so as sites were created with this template, everything worked fine except for “Upload Multiple Documents” and “New Folder” functionality. Both require the existence of the Upload.aspx file mapped to the DefaultNewFormUrl property to work properly. My bad.

Once the bug was identified, I fixed it in the template, but we still had existing sites that had the problem. Deploying a new version of the web template doesn’t retroactively fix existing sites, so we needed to find another solution.

Manual FixAlthough not ideal, there is a way to manually fix this issue:

Open the site in SharePoint Designer and open “All Files” –> [Affected Doc Lib] –> Forms directory

Right click, New, ASPX, name it “Upload.aspx”, and open the file

Still in Designer, open another library with a good Upload.aspx file and open that file

Copy the source from the good Upload.aspx file and paste it into the Upload.aspx source of the new file just created

Change a few values in the properties of the ListFormWebPart:

“Title” should be the title of the document library

“ListName” should be the ID of the list, with curly brackets surrounding the ID

“ListId” should be the ID of the list, without curly brackets

Save the file

That should do it. Now you can upload multiple files, and create new folders. Sweet!

Desired FixHere’s where I deviate from my normal theme of blog postings. Although the manual fix is nice, what I really wanted was a way to script the fix so we could quickly and repeatedly update multiple libraries that were affected. This need leads me to PowerShell and figuring out how to add the Upload.aspx file to the affected libraries through a script.

Running this script added the Upload.aspx file to the library and properly associated it with the DefaultNewFormUrl property of the library. Multiple upload worked great. Adding a new folder was looking good…clicking on New Folder would open the correct form with the ribbon and Name field, but after clicking Save, would throw an error “Value does not fall within the expected range” for SPFileSystemObjectType when trying to create the folder.

For the life of me, I cannot figure out how to fix that! So here’s the challenge: Duplicate this in your environment by creating a document library, opening the site in SharePoint Designer, open the Forms directory in the library, delete the Upload.aspx file, and then create a PowerShell script to add a new Upload.aspx file that works. If you make more progress than I did, please comment.

0 thoughts on “Missing Upload.aspx in a Document Library”

Thanks a lot for posting this script!
It works just fine in my case and folders a created successfully.
The only thing I have changed – the list url starts with “Lists” e.g. “Lists/ChangeRequests/Forms/Upload.aspx”
Did you try to allow for management of content types in your library and add a Folder type as an allowed one?
In my case that was not needed though…

Hi Ryan, great post !
This worked for me but while I fixed one library, another one got corrupted.
I have a site collection with 8 Libraries. 4 of them didn’t have the upload.aspx. I started to fix the first one. Worked! While I fixed the second one, the first one stopped working again…while I fixed third one, first and second one failed again…etc.
I wonder if there are more values to fix than described in your blog above?