File Template Overview

Site Map
 
Home
 
Application Guide
Reference
Community
Contact Whitebeam
To-Do
Download
Credits
Licence
Whitebeam Users
 
 
 

File Template Overview

File Object Overview

Introduction

The File Template maintains a repository for file or binary information such as documents and images.

Concepts

A file has a standard set of properties such as file name, owner, and description. It also has a file definition that combines file mime (describing the type of file), size and binary data or location. Each file in the database is automatically allocated a unique identifier (fileID) when it is created.

The file template allows an extensive set of search criteria to be specified for retrieving files. To narrow down the search results, keywords can additionally be specified along with the elements of data in which find matches. It is also possible to specify how much data is returned for all categories or items matching the search criteria. Reducing the amount of data returned may increase the overall turnaround time for the search. It is also possible to specify the index of the first item to be retrieved from the set of results matching the set criteria.

The binary data type supports three key methods:

MethodDescription

load()

Loads the file's binary data using the specified file path and filename in the parameter string into a binary object and sets the mime type.

fname()

Sets the file path in the binary object to the specified parameter string.

mime()

Sets the mime in a binary object to the specified parameter string.

Example Uses

All images used in generating web pages can be easily stored and retrieved via the File template as can files to be made available for download to a user.

To load a known and single file onto the Whitebeam system...

1.   Set up a Javascript object with the details of the file to be created:

file_create = new Object;
file_create.fileDef = new Binary;
file_create.name = “file name”;
file_create.owner = “Marketing”;
file_create.description = “picture of the team”;

2.   Load the file from the file system:

file_create.fileDef.load( “team.gif” );

3.   Create the file:

var fileID = rb.file.create(file_create);

To load any file or multiple files onto the Whitebeam system …

1.   Present a HTML form to capture the file details:

… <input type = “text” name = “name”>

… <input type = “file” name = fileDef”>

2.   Get the file details using Whbitebeam JavaScript:

var input = rb.page.formdata();

3.   Set up a JavaScript object with the details of the file to be created:

file_create = new Object;
file_create.name = input.name;
file_create.owner = input.owner;
file_create.description = input.description;
file_create.fileDef = input.fileDef;

4.   Call the method to create the file:

var fileID = rb.file.create(file_create);
Whitebeam release 1.3.36
(loadtime : 6ms)