\MainWP\DashboardMainWP_QQ2_File_Uploader

Class MainWP_QQ2_File_Uploader

Summary

Methods
Properties
Constants
__construct()
handle_upload()
handleUpload()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
to_bytes()
$allowedExtensions
$sizeLimit
$file
N/A

Properties

$allowedExtensions

$allowedExtensions : array

Private variable to hold allowed file extensions.

Type

array — Allowed extension.

$sizeLimit

$sizeLimit : integer

Private variable to hold allowed file size.

Type

integer — Size limit.

$file

$file : mixed

Private variable to hold the file to upload.

Type

mixed — The file.

Methods

__construct()

__construct(array  $allowedExtensions = array(), integer  $sizeLimit = 8388608) 

MainWP_QQ2_File_Uploader constructor.

Run each time the class is called.

Parameters

array $allowedExtensions

Array of allowed Extensions.

integer $sizeLimit

Maximum allowed file size.

handle_upload()

handle_upload(mixed  $uploadDirectory, boolean  $replaceOldFile = false) : array

Handle the file upload.

Parameters

mixed $uploadDirectory

File Upload directory.

boolean $replaceOldFile

True|False Weather or not to replace the orignal file or not.

Returns

array —

success'=>true|error'=>'error message'

handleUpload()

handleUpload(mixed  $uploadDirectory, boolean  $replaceOldFile = false) : array

Wrap of the method handle_upload() for compatible.

Parameters

mixed $uploadDirectory

File Upload directory.

boolean $replaceOldFile

True|False Weather or not to replace the orignal file or not.

Returns

array —

success'=>true|error'=>'error message'

to_bytes()

to_bytes(integer  $str) : integer

Convert file size into bytes.

Parameters

integer $str

Original File.

Returns

integer —

$val File Size in Bytes.