Use of Binary File in Kooboo

There are 4 ways to use binary files in Kooboo.

File Controltype in Text Schema



You can define a column within a Text Schema with the controltype of "file". This allows you to upload one file into the Text content.

You may use this mehtod when there there is a fixed amount of files to be uploaded. You can access to the file URL same as a text column. For example, <%=Url.ResolveUrl(item["myfile"].ToString())%>

File Included



In the Text Scheme "Advanced" tab, there is a checkbox "File included". Checking this will include a file upload dialog in the content editing screen. You can upload unlimited amount of files in the text content.

Accessing files in "File Included" is identical as accessing file in binary schema. You may use code like:
foreach (var fileitem in this.ContentService.GetAttachments(Convert.ToInt32(item["ContentId"])))
    {    
         Response.Write(@"
  • "); Response.Write(Url.ResolveUrl(fileitem.FileUrl.ToString())); Response.Write(@"
  • "); }

    The file object returned contains the following fields.
    public class FileInContent
        {
            public FileInContent();
            public string BinaryContentTitle { get; set; }
            public Guid BinaryContentUUID { get; set; }
            public string FileUrl { get; set; }
        }
    



    Binary Schema



    Define a binary schema, create a binary folder, upload files into it and then assign this Binary Schema to a Text Schema.

    You can store all of your binary files in one folder and assign them to text content. One binary file can be assigned to multiple text content and one text content can contains multiple binary files.

    Accessing binary schema content is same as accessing files in "File Included."

    Binary Resource



    Binary Resource is disk based file storage, you can find it under "Design" -> "Binary Resource". You can zip a folder, upload it and then unzip.

    Files in this folder can be access directly by file url. For example
    
    
    
    OR
    
    
    
    


    Url.ResolveUrl



    This is an important mehtod used to correct file URL location. Because Kooboo might be run under a virtual directory, this method will determine the situation and choose the correct URL.