Class XoopsMediaUploader
Upload Media files
Example of usage:
include_once 'uploader.php'; $allowed_mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png'); $maxfilesize = 50000; $maxfilewidth = 120; $maxfileheight = 120; $uploader = new XoopsMediaUploader('/home/xoops/uploads', $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight); if ($uploader->fetchMedia($_POST['uploade_file_name'])) { if (!$uploader->upload()) { echo $uploader->getErrors(); } else { echo '<h4>File uploaded successfully!</h4>' echo 'Saved as: ' . $uploader->getSavedFileName() . '<br>'; echo 'Full path: ' . $uploader->getSavedDestination(); } } else { echo $uploader->getErrors(); }
Package: kernel
Copyright: (c) 2000-2016 XOOPS Project (www.xoops.org)
License: GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html)
Author: Kazumi Ono (http://www.myweb.ne.jp/, http://jp.xoops.org/)
Author: Taiwen Jiang phppp@users.sourceforge.net
Located at lass/uploader.php
Copyright: (c) 2000-2016 XOOPS Project (www.xoops.org)
License: GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html)
Author: Kazumi Ono (http://www.myweb.ne.jp/, http://jp.xoops.org/)
Author: Taiwen Jiang phppp@users.sourceforge.net
Located at lass/uploader.php
public
|
#
__construct( string $uploadDir, array $allowedMimeTypes, integer $maxFileSize = 0, integer $maxWidth = null, integer $maxHeight = null, boolean $randomFilename = false )
Constructor |
public
integer
|
|
public
boolean
|
|
public
|
|
public
|
|
public
string
|
|
public
string
|
|
public
integer
|
|
public
string
|
|
public
string
|
|
public
string
|
|
public
boolean
|
|
public
boolean
|
|
public
boolean
|
|
public
boolean
|
|
public
boolean
|
|
public
boolean
|
|
public
boolean
|
|
public
|
|
public
|
|
public
array
&
|
public
boolean
|
$allowUnknownTypes
Flag indicating if unrecognized mimetypes should be allowed (use with precaution ! may lead to security issues ) |
#
false
|
public
|
$mediaName
|
|
public
|
$mediaType
|
|
public
|
$mediaSize
|
|
public
|
$mediaTmpName
|
|
public
|
$mediaError
|
|
public
string
|
$mediaRealType
|
#
''
|
public
string
|
$uploadDir
|
#
''
|
public
array
|
$allowedMimeTypes
|
#
array()
|
public
array
|
$deniedMimeTypes
|
#
array(
'application/x-httpd-php')
|
public
integer
|
$maxFileSize
|
#
0
|
public
|
$maxWidth
|
|
public
|
$maxHeight
|
|
public
|
$targetFileName
|
|
public
|
$prefix
|
|
public
array
|
$errors
|
#
array()
|
public
|
$savedDestination
|
|
public
|
$savedFileName
|
|
public
array
|
$extensionToMime
|
#
array()
|
public
boolean
|
$checkImageType
|
#
true
|
public
array
|
$extensionsToBeSanitized
|
#
array(
'php',
'phtml',
'phtm',
'php3',
'php4',
'cgi',
'pl',
'asp',
'php5',
'php7',
)
|
public
array
|
$imageExtensions
|
#
array(
1 => 'gif',
2 => 'jpg',
3 => 'png',
4 => 'swf',
5 => 'psd',
6 => 'bmp',
7 => 'tif',
8 => 'tif',
9 => 'jpc',
10 => 'jp2',
11 => 'jpx',
12 => 'jb2',
13 => 'swc',
14 => 'iff',
15 => 'wbmp',
16 => 'xbm')
|
public
boolean
|
$randomFilename
|
#
false
|