Saturday, 9 May 2009

Content Editor WebPart to Upload Multiple Documents to SharePoint Library

Today I got a cute requirement from my client manager to upload a huge bunch of documents to sharepoint library, for which they are unable to get "Multiple Upload" feature.
Then as an immediate resolution I have added an content Editor Web Part and added this piece of code chunks into that.
In this we are using the existing Upload file which can be found at 12 hive\Layouts.

<SCRIPT LANGUAGE="javascript">

function FilesUpload()
alert('File Uploading Completed');

<INPUT TYPE="hidden" NAME="Cmd" VALUE="Save">
<INPUT TYPE="hidden" NAME="NextUsing" VALUE="http://[Server]/[Document Library]/Forms/AllItems.aspx">
<INPUT TYPE="hidden" VALUE="New">
<INPUT TYPE="hidden" NAME="putopts" VALUE="true">
<INPUT TYPE="hidden" NAME="destination" VALUE="http://[Server]/[Document Library]">
<INPUT TYPE="hidden" NAME="Confirmation-URL" VALUE="http://[Server]/[Document Library]/Forms/AllItems.aspx">
<INPUT TYPE="hidden" NAME="PostURL" VALUE="http://[Server]/_vti_bin/shtml.dll/_layouts/UpLoad.aspx" />

<DIV ID='MukiDidAgain' >
<P CLASS="ms-toolbar">
<A HREF="javascript:FilesUpload()"
TARGET="_self">Save Files</A>
<OBJECT id=idUploadCtl name=idUploadCtl CLASSID=CLSID:07B06095-5687-4d13-9E32-12B4259C9813 WIDTH='100%' HEIGHT='350px'></OBJECT>

! Replace [Server] with your server URL and [Document Library] with the desired document library

Cheers! we are done
Happy SPD'ing.

No comments: