LoadFile$

Takes three parameters, FilePath, Start, Len

Usage:

FilePath, Start, Len
FilePath, Start, [remainder of file]
FilePath, [start of file], [remainder of file]

Description:

Loads a local server file from an accessible file path. This is the Top Query version of File "Load", but has the additional optional parameters Start and Len.

The optional Start parameter may specify a positive number to indicate the start position, based on 1, from the beginning of the file. A negative number will be relative to the end of the file, with -1 indicating the last byte. If this parameter is omitted or zero, the Start position will be the first byte, i.e. 1.

The optional Len parameter may specify a positive number to indicate the number of types to be read. A negative number will be relative to the length of the file, with -1 indicating one byte less than the total file length. If this parameter is omitted or zero, the Len will be the remainder of the file.

If the Top Query field Error does not already exist when this command is run, it will be created. If it does exist, it will be cleared before the specified Action is run. If an error occurs, a runtime error will be thrown, which may be caught with a Try/Catch block and the error string can be inspected or reported using the Top Query Error field.

Example:

[New] FileData

FileData = LoadFile$ "Private/GoodFile.png", 10, -20
Html (WebSafe$ (Left$ FileData, 256))

Try
  FileData = LoadFile$ "Private/NotFound.txt"
Catch
HtmlErr ("Sorry, we found an error: " & Error) 'Example only. System level error details should not be displayed to users
End Try