Uploader Class
The Uploader is generalized way to upload any number of file types. Located in the namespace Canteen\Media.
Constructor
Uploader
(
-
inputName
-
uploadDir
-
mimeTypes
-
fileExts
-
[filename='']
Item Index
Properties
Methods
fixFilename
(
String
private
-
file
Fix the file name by removing non-valid characters
Parameters:
-
file
StringThe input file name
Returns:
String:
The sanitized filename
initCheck
(
Boolean
private
-
overwrite
Run the initial check for the file type and extensions
Parameters:
-
overwrite
BooleanIf we can overwrite the file
Returns:
Boolean:
If the check was successful
postCheck
()
Boolean
private
Post check after upload to make sure everything went well
Returns:
Boolean:
True if everything went well
upload
(
-
[overwrite=false]
-
[maxSize=Uploader::DEFAULT_SIZE]
Upload the file
Parameters:
-
[overwrite=false]
Boolean optionalIf we should overwrite the existing file
-
[maxSize=Uploader::DEFAULT_SIZE]
Int optionalThe maximum file size in bytes (default 1MB)
Properties
DEFAULT_SIZE
Int
final
static
The default max file size in bytes
Default: 1048576
filesize
Int
protected
The size of the uploaded file
maxSize
Int
protected
The maximum size of the file upload in bytes
memoryLimit
Int
protected
PHP's memory limit in bytes