从HtmlInputFile控件中读取文件 保存到document libary中.

    SPSite site = SPControl.GetContextSite(Context);
    SPWeb web = site.AllWebs[0];

    SPFolderCollection AddFold = web.Folders ;  
    SPFileCollection destFiles = web.GetFolder("Lists/ContractDocument").Files;

    HttpPostedFile file = f_Input.PostedFile
    byte[] docby = new byte[file.ContentLength];
   Stream fileStream=file.InputStream;
   fileStream.Read(docby,0,file.ContentLength);
  

    string desURL=web.GetFolder("Lists/ContractDocument").Url+"/test.doc";
    destFiles.Add(desURL,test);

你可能感兴趣的:(document)