Files uploaded to the wrong folder in a document library
Posted
Wednesday, March 10, 2010 10:30 AM
by
CoreyRoth
This is kind of a weird one so I thought it was definitely worth posting. Recently we were doing some integration testing where an external application was linking directly to specific folders. The users would then upload a document in that folder and then they could not find their file. Where was the file? Well it was sitting in the root folder for some reason. Consider the following URL that was being used.
http://moss-server/MySiteCollection/MySite/DocumentLibrary/SubFolder
This can also be expressed like this using the RootFolder parameter.
http://moss-server/MySiteCollection/MySite/DocumentLibrary/Allitems.aspx?RootFolder=/MySiteCollection/MySite/DocumentLibrary/SubFolder
The application linking to us was using a path very similar to the ones above. However, when the user tried to upload the file after coming from that external application, the file they uploaded would be sitting in the root folder every time. It was strange because, the user was in the correct folder when they followed the link, but when they clicked Upload I noticed the breadcrumb did not have the subfolder listed in it. When I tried browsing to the folder in SharePoint and uploading it worked correctly. Something strange was definitely going on. I started examining everything and I took a look at the link they were using to get to us. Here is what they were using.
http://moss-server/mysitecollection/mysite/documentlibrary/subfolder
Notice the difference? Exactly, the URL they were using was all lower case. I thought surely case sensitivity wouldn’t be the cause. I corrected the case in the application and sure enough files started going into the correct folder. I couldn’t find anything on the internet about this at all until I discovered the case sensitivity and found this post that confirmed a similar issue. If you don’t believe me, go to any document library on your server and try changing the case and see what happens. :)
What it comes down is that the case matters in the URL on everything after the server name. I created the site collection as MySiteCollection (ok no I really don’t have a site collection named this, but this is an example :) ), so that means any time you have a URL the case better match. The problem is you might not remember how you set the case up when you created the site, site collection, or document library. If you don’t there is an easy way to figure it out, just browse to the subfolder you want and copy the URL from your browser. If you URL decode the RootFolder querystring parameter you will see the casing that should be used. I hope this helps in case you happen to run into it.