fileload(
PATH
)

The fileload( function reads the entire contents of any file on disk.


Parameters

This function has one parameter:

path – is a path to the file to be loaded, including the file name (see Files and Folders for more information about file paths).


Description

This function returns the entire contents of the specified file as binary data (see Binary Data). This example displays the contents of a file named news.txt in the Documents folder.

displaydata fileload("~/Documents/news.txt")

In the example above, the binary data contained in the news.txt file is automatically converted to text so that it can be displayed with the displaydata statement. Panorama performs this conversion automatically when binary data is passed to a function or statement that requires text. When it performs this automatic conversion, Panorama assumes that the text is encoded in UTF-8 (Unicode) format (the standard format on modern computer systems).

If the text is not in UTF-8 format you must perform this conversion explicitly with the binarytotext( function. For example, a text file created with Panorama 6 or earlier is encoded using MacOSRoman, the encoding method used by Mac OS 9 (and earlier versions of Mac OS). Here’s how to read such a file:

displaydata binarytotext(fileload("~/Documents/news.txt"),"MacOSRoman")
Legacy Syntax (Separate Folder and File Parameters)

In older versions of Panorama (6.0 and earlier) the fileload( had two parameters, folderid and filename. To maintain compatibility with older databases, two parameters will still work, as shown in this example:

displaydata fileload(folder("~/Documentation"),"news.txt")

For new databases you’ll probably find it easier to use the single parameter mode.


See Also


History

VersionStatusNotes
10.0UpdatedCarried over from Panorama 6.0, but now may have either one parameter (path) or two (folder, path).