CreateBinaryData() public static method

Creates BinaryData from HttpPostedFile
public static CreateBinaryData ( System.Web.HttpPostedFile file ) : BinaryData
file System.Web.HttpPostedFile
return SenseNet.ContentRepository.Storage.BinaryData
Exemplo n.º 1
0
        /// <summary>
        /// Creates new Node of specified Content Type
        /// </summary>
        /// <param name="contentTypeName"></param>
        /// <param name="parent"></param>
        /// <param name="fileName"></param>
        /// <param name="stream"></param>
        public static void CreateNodeOfType(string contentTypeName, Node parent, string fileName, Stream stream)
        {
            var node = new SenseNet.ContentRepository.File(parent, contentTypeName);

            if (CheckAllowedContentType(parent as GenericContent, node))
            {
                node.Name = fileName;
                node.SetBinary("Binary", UploadHelper.CreateBinaryData(fileName, stream));
                node.Save();
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Modify node's binary
 /// </summary>
 /// <param name="node"></param>
 /// <param name="stream"></param>
 public static void ModifyNode(Node node, Stream stream)
 {
     node.SetBinary("Binary", UploadHelper.CreateBinaryData(node.Name, stream));
     node.Save();
 }
Exemplo n.º 3
0
 // ------------------------------------------------------------------ Static methods
 public static BinaryData CreateBinaryData(HttpPostedFile file)
 {
     return(UploadHelper.CreateBinaryData(file));
 }