SPSite site = SPContext.Current.Site; using (SPWeb web = site.OpenWeb("MySite")) { SPFolder targetFoler = web.Lists["Shared Documents"].RootFolder; Stream fStream = fileUploader.PostedFile.InputStream; byte[] contents = new byte[fStream.Length]; fStream.Read(contents, 0, (int)fStream.Length); fStream.Close(); targetFoler.Files.Add(fileUploader.FileName, contents); }
Hope this helps.
No comments:
Post a Comment