\CogiUpload

CogiUpload : PHP Class for file uploading

Summary

Methods
Properties
Constants
__construct()
setPathToUpload()
setNameForFile()
debug()
processUpload()
No public properties found
ERR_MOVE
No protected methods found
No protected properties found
N/A
No private methods found
$_extensionList
$_pathToUpload
$_nameForFile
$_fileName
$_fileExtension
$_fileType
$_fileTmpName
$_fileSize
$_limitSize
$_fullPathForFile
N/A

Constants

ERR_MOVE

ERR_MOVE

Constant error if the file can not be moved

Properties

$_extensionList

$_extensionList : array

List of extensions allowed

Type

array

$_pathToUpload

$_pathToUpload : string

Folder path where the file must be uploaded

Type

string

$_nameForFile

$_nameForFile : string

New name for the uploaded file

Type

string

$_fileName

$_fileName : string

Original name of the file

Type

string

$_fileExtension

$_fileExtension : string

Extension of the file

Type

string

$_fileType

$_fileType : string

Type of the file

Type

string

$_fileTmpName

$_fileTmpName : string

Tmpname of the file

Type

string

$_fileSize

$_fileSize : string

Size of the file

Type

string

$_limitSize

$_limitSize : string

Size max for upload

Type

string

$_fullPathForFile

$_fullPathForFile : string

Full path for the uploaded file

Type

string

Methods

__construct()

__construct(string  $file, string  $extensionList, integer  $limit = 1000000000) : void

Constructor.

Initialize the component with informations.

Parameters

string $file

$_FILE.

string $extensionList

List of extensions allowed.

integer $limit

(optional) Size maximum in bytes.

setPathToUpload()

setPathToUpload(string  $path) : void

Set the path.

Set the path of the folder to upload the file.

Parameters

string $path

Path of the folder.

Throws

\InvalidArgumentException

If the folder path does not exist.

setNameForFile()

setNameForFile(string  $name) : void

Set the file name.

Set the name of the file you want on the upload folder.

Parameters

string $name

Name of the file, whitout extension.

Throws

\InvalidArgumentException

If the name is not a string.

debug()

debug() : void

Upload debug.

Display a formated dump of the object.

processUpload()

processUpload() : string

Process the file.

Process the uploaded file with the options setted.

Throws

\InvalidArgumentException

If the file cannot be processed.

Returns

string —

The full url of the file processed