File/file-defs.php

Description
Classes
Class Description
 class inputfile The inputfile class manages files for input. It opens, reads and closes files in input-only mode.
 class csv_inputfile CSV Inputfile class Manage CSV-formatted files for input.
 class stylesheet Open a file which contains a stylesheet and read in the style settings. This is a special case of inputfile.
 class outputfile The outputfile class manages files for outputting content. This includes both appending to an existing file, and creating new files. The method used in both cases is to write to a temporary file, and then rename/move it onto the final file path when closefile() is called.
 class quickfile This is a derived class from outputfile and is a quick way of creating a file with content in a single hit. You can check the $created property afterwards to determine success/failure.
 class fileupload Fileupload class.
Constants
ABANDON_FILE = 1 (line 33)

Abandon file on close

SAVE_FILE = (line 31)

Save the file on close

UPLOAD_E_ACCESS = 104 (line 665)

Destination directory access problem

UPLOAD_E_BADTYP = 102 (line 661)

Uploaded file was not of an allowed mime type

UPLOAD_E_HACK = 103 (line 663)

Attempt to move a non-uploaded file. Hacking.

UPLOAD_E_MAXSIZ = 101 (line 659)

Uploaded file exceeded the given maximum size

UPLOAD_E_MOV = 100 (line 657)

Failed to move file, filesys error (perms?)

UPLOAD_E_OK = (line 655)

Error code: All ok, no errors

Functions
get_dirlist (line 124)

Returns an array containing full paths to the files in the directory

given by the path. This can be optionally recursive, in which case we will end up with a long list of path/filenames which comprise the whole tree, minus the special files '.' and '..'

  • return: List of full paths that comprise files in the directory, or tree
array get_dirlist (string $path, [boolean $recurse = false], [$regex $regex = ""])
  • string $path: Path to the directory containing the files to list
  • boolean $recurse: Whether to recurse the tree listing files in subdirs
  • $regex $regex: Full regular expression filename must match, eg: '/^.*?\.jpg$/i'
get_file_extn (line 90)

Return the file extension from a filepath.

void get_file_extn (mixed $path)
get_file_stem (line 103)

Return the file stem (name without extn) from a filepath.

void get_file_stem (mixed $path)
mkpath (line 62)

Make sure path exists A utility function which makes sure a given directory path is made, using mkdir as required. This function assumes that permissions are all as needed.

void mkpath (string $path)
  • string $path: The directory path which must exist
unique_filename (line 45)

Return a random unique filename, with optional prefix and an optional extension. The filename is composed from an md5 of microtime(), plus the prefix and extension if given.

  • return: Unique filename string
string unique_filename ([string $prefix = ""], [string $extn = ""])
  • string $prefix: Optional fixed prefix required.
  • string $extn: Optional fixed extension required.

Documentation generated by phpDocumentor 1.3.0RC3