private void ModifySpecificContent(IFolder node, HttpPostedFile file, string path) { ContentFacade contentFacade = new ContentFacade(); contentFacade.Load(path); if (contentFacade.CurrentContent != null) { BinaryField bf = contentFacade.CurrentContent.Fields["Binary"] as BinaryField; if (bf != null) { BinaryData bd = CreateBinaryData(file); bf.SetData(bd); } } contentFacade.CurrentContent.Save(); }
private void CreateSpecificContent(HttpContext context, string contentTypeName, IFolder parentNode, HttpPostedFile postedFile) { ContentFacade contentFacade = new ContentFacade(); contentFacade.CreateNew(contentTypeName, ((Node)parentNode)); if (CheckAllowedContentType(parentNode as GenericContent, contentFacade.CurrentContent.ContentHandler, context)) { // set name ShortTextField sf = contentFacade.CurrentContent.Fields["Name"] as ShortTextField; var fn = System.IO.Path.GetFileName(postedFile.FileName); sf.SetData(fn); // set binary BinaryData b = CreateBinaryData(postedFile); BinaryField bf = contentFacade.CurrentContent.Fields["Binary"] as BinaryField; bf.SetData(b); contentFacade.CurrentContent.Save(); } }