XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
XoopsMediaUploader Class Reference

Public Member Functions

 __construct ($uploadDir, $allowedMimeTypes, $maxFileSize=0, $maxWidth=null, $maxHeight=null)
 
 setAllowedExtensions ($extensions)
 
 setStrictCheckExtensions ($extensions)
 
 fetchMedia ($media_name, $index=null)
 
 setTargetFileName ($value)
 
 setPrefix ($value)
 
 getMediaName ()
 
 getMediaType ()
 
 getMediaSize ()
 
 getMediaTmpName ()
 
 getSavedFileName ()
 
 getSavedDestination ()
 
 upload ($chmod=0644)
 
 _copyFile ($chmod)
 
 checkMaxFileSize ()
 
 checkMaxWidth ()
 
 checkMaxHeight ()
 
 checkMimeType ()
 
 _checkStrict ()
 
 checkExpectedMimeType ()
 
 setErrors ($error)
 
getErrors ($ashtml=true)
 

Data Fields

 $allowUnknownTypes = false
 
 $mediaName
 
 $mediaType
 
 $mediaSize
 
 $mediaTmpName
 
 $mediaError
 
 $mediaRealType = ''
 
 $uploadDir = ''
 
 $allowedMimeTypes = []
 
 $allowedExtensions = []
 
 $maxFileSize = 0
 
 $maxWidth
 
 $maxHeight
 
 $targetFileName
 
 $prefix
 
 $errors = []
 
 $savedDestination
 
 $savedFileName
 
 $extensionToMime = []
 
 $_strictCheckExtensions = []
 

Detailed Description

Definition at line 42 of file uploader.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( $uploadDir,
$allowedMimeTypes,
$maxFileSize = 0,
$maxWidth = null,
$maxHeight = null )

Constructor

Parameters
string$uploadDir
array$allowedMimeTypes
int$maxFileSize
int$maxWidth
int$maxHeight

Definition at line 78 of file uploader.php.

Member Function Documentation

◆ _checkStrict()

_checkStrict ( )

Definition at line 413 of file uploader.php.

◆ _copyFile()

_copyFile ( $chmod)

Copy the file to its destination

Parameters
$chmod
Returns
bool

Definition at line 306 of file uploader.php.

◆ checkExpectedMimeType()

checkExpectedMimeType ( )

Check whether or not the uploaded file type is allowed

Returns
bool

Definition at line 429 of file uploader.php.

◆ checkMaxFileSize()

checkMaxFileSize ( )

Is the file the right size?

Returns
bool

Definition at line 328 of file uploader.php.

◆ checkMaxHeight()

checkMaxHeight ( )

Is the picture the right height?

Returns
bool

Definition at line 358 of file uploader.php.

◆ checkMaxWidth()

checkMaxWidth ( )

Is the picture the right width?

Returns
bool

Definition at line 338 of file uploader.php.

◆ checkMimeType()

checkMimeType ( )

Check whether or not the uploaded file type is allowed

Returns
bool

Definition at line 378 of file uploader.php.

◆ fetchMedia()

fetchMedia ( $media_name,
$index = null )

Fetch the uploaded file

Parameters
string$media_nameName of the file field
int$indexIndex of the file (if more than one uploaded under that name)
Returns
bool

Definition at line 123 of file uploader.php.

◆ getErrors()

& getErrors ( $ashtml = true)

Get generated errors

Parameters
bool$ashtmlFormat using HTML?
Returns
array|string Array of array messages OR HTML string

Definition at line 455 of file uploader.php.

◆ getMediaName()

getMediaName ( )

Get the uploaded filename

Returns
string

Definition at line 205 of file uploader.php.

◆ getMediaSize()

getMediaSize ( )

Get the size of the uploaded file

Returns
int

Definition at line 225 of file uploader.php.

◆ getMediaTmpName()

getMediaTmpName ( )

Get the temporary name that the uploaded file was stored under

Returns
string

Definition at line 235 of file uploader.php.

◆ getMediaType()

getMediaType ( )

Get the type of the uploaded file

Returns
string

Definition at line 215 of file uploader.php.

◆ getSavedDestination()

getSavedDestination ( )

Get the destination the file is saved to

Returns
string

Definition at line 255 of file uploader.php.

◆ getSavedFileName()

getSavedFileName ( )

Get the saved filename

Returns
string

Definition at line 245 of file uploader.php.

◆ setAllowedExtensions()

setAllowedExtensions ( $extensions)

Definition at line 106 of file uploader.php.

◆ setErrors()

setErrors ( $error)

Add an error

Parameters
string$error

Definition at line 443 of file uploader.php.

◆ setPrefix()

setPrefix ( $value)

Set the prefix

Parameters
string$value

Definition at line 195 of file uploader.php.

◆ setStrictCheckExtensions()

setStrictCheckExtensions ( $extensions)

Definition at line 111 of file uploader.php.

◆ setTargetFileName()

setTargetFileName ( $value)

Set the target filename

Parameters
string$value

Definition at line 185 of file uploader.php.

◆ upload()

upload ( $chmod = 0644)

Check the file and copy it to the destination

Parameters
int$chmod
Returns
bool

Definition at line 266 of file uploader.php.

Field Documentation

◆ $_strictCheckExtensions

$_strictCheckExtensions = []

Definition at line 67 of file uploader.php.

◆ $allowedExtensions

$allowedExtensions = []

Definition at line 56 of file uploader.php.

◆ $allowedMimeTypes

$allowedMimeTypes = []

Definition at line 55 of file uploader.php.

◆ $allowUnknownTypes

$allowUnknownTypes = false

Flag indicating if unrecognized mimetypes should be allowed (use with precaution ! may lead to security issues )

Definition at line 47 of file uploader.php.

◆ $errors

$errors = []

Definition at line 62 of file uploader.php.

◆ $extensionToMime

$extensionToMime = []

Definition at line 65 of file uploader.php.

◆ $maxFileSize

$maxFileSize = 0

Definition at line 57 of file uploader.php.

◆ $maxHeight

$maxHeight

Definition at line 59 of file uploader.php.

◆ $maxWidth

$maxWidth

Definition at line 58 of file uploader.php.

◆ $mediaError

$mediaError

Definition at line 52 of file uploader.php.

◆ $mediaName

$mediaName

Definition at line 48 of file uploader.php.

◆ $mediaRealType

$mediaRealType = ''

Definition at line 53 of file uploader.php.

◆ $mediaSize

$mediaSize

Definition at line 50 of file uploader.php.

◆ $mediaTmpName

$mediaTmpName

Definition at line 51 of file uploader.php.

◆ $mediaType

$mediaType

Definition at line 49 of file uploader.php.

◆ $prefix

$prefix

Definition at line 61 of file uploader.php.

◆ $savedDestination

$savedDestination

Definition at line 63 of file uploader.php.

◆ $savedFileName

$savedFileName

Definition at line 64 of file uploader.php.

◆ $targetFileName

$targetFileName

Definition at line 60 of file uploader.php.

◆ $uploadDir

$uploadDir = ''

Definition at line 54 of file uploader.php.


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