c# - Is it Possible to upload file to SharePoint Doc libary with jquery? -


is possible upload document sharepoint document library jquery code?

is there equivalent control asp:fileupload on client side selecting file?

here's goal:
1) solution should code block paste in; , not webpart or compiled solution or app.
2) , don't want use native sharepoint file upload or editform page comes set metadata.

create new sharepoint aspx page that:

  • enables users upload selected file specific sharepoint document library specific hard coded user
  • rename file random unique sequence if :
  • the file not exist.
  • the file must specific file type (pdf)
  • must able set metadata column values file

these links lead me believe might possible:

http://msdn.microsoft.com/en-us/library/ms454491(v=office.14).aspx

http://blog.yahoo.com/lamung/articles/91696

upload file sharepoint through built-in web services

i pay working solution. ideally client side code using web services.

the following code uploads pdf document library. of you

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script><script src="/style%20library/jquery.spservices-0.6.2.min.js" type="application/javascript"></script><script src="/style%20library/jquery-1.6.2.min.js" type="text/javascript"></script> <script type="text/javascript">    function uploadfile() {      var filepath = "c:\\test.pdf";     var url= "http://site/shared documents/test.pdf";      var soapenv =     "<soap:envelope xmlns:xsi='http://www.w3.org/2001/xmlschema-instance' xmlns:xsd='http://www.w3.org/2001/xmlschema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'> \         <soap:body>\             <copyintoitems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>\                 <sourceurl>" + filepath + "</sourceurl>\                     <destinationurls>\                         <string> "+ url + "</string>\                     </destinationurls>\                     <fields>\                         <fieldinformation type='text' displayname='title' internalname='title' value='test' />\                     </fields>\                 <stream>base64binary</stream>\             </copyintoitems>\         </soap:body>\     </soap:envelope>";      $.ajax({         url: "http://site/_vti_bin/copy.asmx",         beforesend: function (xhr) { xhr.setrequestheader("soapaction", "http://schemas.microsoft.com/sharepoint/soap/copyintoitems"); },         type: "post",         datatype: "xml",         data: soapenv,         complete: processresult,         contenttype: "text/xml; charset=\"utf-8\""     });     alert(soapenv); }   function processresult(xdata, status) {     alert("uploaded successfully"); }  </script> <input name="upload" onclick="uploadfile()" type="button"/> 

Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -