Orion PHP  0.11.12
The PHP5.3 framework
Orion\Core\Upload Class Reference

List of all members.

Public Member Functions

 __construct ($id=null, $folder=null)
 enableFolderCreation ()
 setPrefix ($prefix)
 setSubFolder ($folders=null)
 restrict ()
 thumbnail ($maxsize, $newname=null, $_targetdir=null, $_source=null, $format=null)
 upload ()
 getIdentifier ($type='path', $noprefix=false)
 isImage ($extension=null)
 getSize ()
 getThumbnailIdentifier ($type='path')
 isSuccess ()

Static Public Member Functions

static delete ($path=null)
static deleteDir ($directory, $empty=false)
static getSizeOf ($dir)

Public Attributes


Static Public Attributes

static $BMP = array( 'bmp' )
static $JPEG = array( 'jpeg', 'jpg' )
static $PNG = array( 'png' )
static $GIF = array( 'gif' )
static $SWF = array( 'swf' )
static $XML = array( 'xml' )
static $FILE3D = array( 'dae', 'tmw' )

Private Member Functions

 getData ()
 prepare ()
 fixDupe ()

Private Attributes

 $_SUCCESS = false

Detailed Description

Orion upload class for images or files

Usage: new Upload(ID, FOLDER); upload(); [thumbnail();]

Thibaut Despoulain BSD 4-clauses

Definition at line 17 of file upload.php.

Constructor & Destructor Documentation

Orion\Core\Upload::__construct ( id = null,
folder = null 

configuration $config

string$idthe file form identifier
string$folderpath where to store the file, either real path or Upload::IMAGE_UPLOAD_DIR, Upload::FILE_UPLOAD_DIR to use configuration file
object Upload object or false if error

Definition at line 80 of file upload.php.

Member Function Documentation

static Orion\Core\Upload::delete ( path = null) [static]

Deletes a file from upload dir

String$pathThe relative path to the file to delete. (relative to the upload directory)

Definition at line 448 of file upload.php.

static Orion\Core\Upload::deleteDir ( directory,
empty = false 
) [static]
String$directoryThe relative path to the directory to empty. (relative to the upload directory)
boolean$emptySet this to TRUE to only empty the directory, FALSE|NULL to empty AND remove the directory

Definition at line 476 of file upload.php.

Orion\Core\Upload::enableFolderCreation ( )

Allows creation of folder when it does not exist

Definition at line 180 of file upload.php.

Orion\Core\Upload::fixDupe ( ) [private]

Define a new filename if file already exists (e.g. filename-1.ext)

Definition at line 163 of file upload.php.

Orion\Core\Upload::getData ( ) [private]

Get useful data for upload

array data

Definition at line 123 of file upload.php.

Orion\Core\Upload::getIdentifier ( type = 'path',
noprefix = false 

Used to retrive an identifier to store in a database for example

string$type'path' or 'name' for full path or only filename
string Identifier

Definition at line 380 of file upload.php.

Orion\Core\Upload::getSize ( )

Gets uploaded file size in Octets


Definition at line 408 of file upload.php.

static Orion\Core\Upload::getSizeOf ( dir) [static]

Get the size of a file/directory in K-blocks (~Ko) /!\ Works only on Linux servers /!\

int The size in K-blocks (~Ko)

Definition at line 538 of file upload.php.

Orion\Core\Upload::getThumbnailIdentifier ( type = 'path')

Used to retrive an identifier of the thumbnail to store in a database for example

string$type'path' or 'name' for full path or only filename of the thumbnail
string Thumbnail identifier

Definition at line 418 of file upload.php.

Orion\Core\Upload::isImage ( extension = null)

Definition at line 399 of file upload.php.

Orion\Core\Upload::isSuccess ( )

Returns if the Upload was a success or a failure

boolean success or failure

Definition at line 438 of file upload.php.

Orion\Core\Upload::prepare ( ) [private]

Prepare upload by checking parameters integrity and dupe existence

boolean success or failure

Definition at line 140 of file upload.php.

Orion\Core\Upload::restrict ( )

Restricts file types

[string|string[]]mime types

Definition at line 221 of file upload.php.

Orion\Core\Upload::setPrefix ( prefix)

Adds a prefix to the filename


Definition at line 189 of file upload.php.

Orion\Core\Upload::setSubFolder ( folders = null)

Puts the file into provided sub folder(s)

string$foldersSub folders (multiple = func_get_args)

Definition at line 199 of file upload.php.

Orion\Core\Upload::thumbnail ( maxsize,
newname = null,
_targetdir = null,
_source = null,
format = null 

Create a thumbnail using uploaded image as source

int[]$maxsize in pixels or an array [width, height]
string$newnameThe new name for the thumbnail
string[$_targetdir] The target directory if the thumbnail needs to be in another directory
string[$_source] The source image path (To generate a thumbnail not from an uploaded image, but from a static file on the server)
string[][$format] Provide an overriden format of the thumbnail. This forat consists of an array if the imagenew method in [0] and the extention in [1], example: array('ImageJpeg', 'jpg')
boolean success or failure

Definition at line 243 of file upload.php.

Orion\Core\Upload::upload ( )

Process the final upload using copy()

boolean success or failure

Definition at line 361 of file upload.php.

Member Data Documentation

array Orion::Core\Upload::$_DATA [private]

Store the upload data : ['tmpfile','size','type','targetdir','targetfile','basename','thumbnail','fullpath']

Definition at line 23 of file upload.php.

FILE Orion::Core\Upload::$_INPUT [private]

Stores temporary form FILE

Definition at line 35 of file upload.php.

boolean Orion::Core\Upload::$_SUCCESS = false [private]

contains upload status

Definition at line 29 of file upload.php.

Orion::Core\Upload::$ALLOW_FOLDER_CREATION = false [private]

Definition at line 53 of file upload.php.

array Orion::Core\Upload::$ALLOWED_FILETYPES [private]

Type image/Jpeg for example

Definition at line 47 of file upload.php.

Orion::Core\Upload::$BASE_UPLOAD_DIR = '' [private]

Definition at line 59 of file upload.php.

Orion::Core\Upload::$BMP = array( 'bmp' ) [static]

Definition at line 62 of file upload.php.

Orion::Core\Upload::$FILE3D = array( 'dae', 'tmw' ) [static]

Definition at line 68 of file upload.php.

Orion::Core\Upload::$GIF = array( 'gif' ) [static]

Definition at line 65 of file upload.php.

Orion::Core\Upload::$JPEG = array( 'jpeg', 'jpg' ) [static]

Definition at line 63 of file upload.php.

Orion::Core\Upload::$PNG = array( 'png' ) [static]

Definition at line 64 of file upload.php.

Orion::Core\Upload::$SWF = array( 'swf' ) [static]

Definition at line 66 of file upload.php.

string Orion::Core\Upload::$UPLOAD_DIR [private]

Contains the upload dir path

Definition at line 41 of file upload.php.

Orion::Core\Upload::$XML = array( 'xml' ) [static]

Definition at line 67 of file upload.php.

const Orion::Core\Upload::FILE_UPLOAD_DIR = 'FILE_UPLOAD_DIR'

Definition at line 71 of file upload.php.

const Orion::Core\Upload::IMAGE_UPLOAD_DIR = 'IMAGE_UPLOAD_DIR'

Definition at line 70 of file upload.php.

The documentation for this class was generated from the following file: