FileUtil.php
26 * @param $mediaFile An assoziative array with the following keys: 'name', 'type', 'tmp_name' (typically a $_FILES entry)
29 * @param $override Boolean whether an existing file should be overridden, if false an unque id will be placed in the filename to prevent overriding (default: _true_)
37 $msg = $message->getText("Possible file upload attack: filename %0%.", array($mediaFile['name']));
43 throw new IOException($message->getText("File '%0%' has wrong mime type: %1%. Allowed types: %2%.",
76 * @param $prependDirectoryName Boolean whether to prepend the directory name to each file (default: _false_)
80 public static function getFiles($directory, $pattern='/./', $prependDirectoryName=false, $recursive=false) {
86 throw new IllegalArgumentException($message->getText("The directory '%0%' does not exist.", array($directory)));
116 * @param $prependDirectoryName Boolean whether to prepend the directory name to each directory (default: _false_)
120 public static function getDirectories($directory, $pattern='/./', $prependDirectoryName=false, $recursive=false) {
126 throw new IllegalArgumentException($message->getText("The directory '%0%' does not exist.", array($directory)));
168 throw new IllegalArgumentException($message->getText("Cannot copy %0% (it's neither a file nor a directory).", array($source)));
IllegalArgumentException signals an exception in method arguments.
Definition: IllegalArgumentException.php:18
static sanitizeFilename($file)
Get a sanitized filename code from: http://stackoverflow.com/questions/2021624/string-sanitizer-for-f...
Definition: FileUtil.php:256
static getInstance($name, $dynamicConfiguration=array())
Definition: ObjectFactory.php:39
static uploadFile($mediaFile, $destName, $mimeTypes=null, $override=true)
Copy an uploaded file to a given destination (only if the mime type mathes the given one)...
Definition: FileUtil.php:32
static getDirectories($directory, $pattern='/./', $prependDirectoryName=false, $recursive=false)
Definition: FileUtil.php:120
static realpath($path)
Realpath function that also works for non existing paths code from http://www.php.net/manual/en/function.realpath.php.
Definition: FileUtil.php:225
static getFiles($directory, $pattern='/./', $prependDirectoryName=false, $recursive=false)
Definition: FileUtil.php:80
IOException signals an exception in i/o operations.
Definition: IOException.php:18
FileUtil provides basic support for file functionality like HTTP file upload.
Definition: FileUtil.php:22