Class MediaUploader
XOOPS file uploader
Example of usage:
$allowed_mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png'); $maxfilesize = 50000; $maxfilewidth = 120; $maxfileheight = 120; $uploader = new Xoops\Core\MediaUploader( '/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(); }
Direct known subclasses
XoopsMediaUploader
Namespace: Xoops\Core
Package: MediaUploader
Category: Xoops\Core\MediaUploader
Copyright: 2003-2014 XOOPS Project (http://xoops.org)
License: GPL 2 or later (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
Link: http://xoops.org
Located at oops_lib/Xoops/Core/MediaUploader.php
Package: MediaUploader
Category: Xoops\Core\MediaUploader
Copyright: 2003-2014 XOOPS Project (http://xoops.org)
License: GPL 2 or later (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
Link: http://xoops.org
Located at oops_lib/Xoops/Core/MediaUploader.php
public
|
#
__construct( string $uploadDir, array $allowedMimeTypes, integer $maxFileSize = 0, integer $maxWidth = null, integer $maxHeight = null )
Constructor |
public
boolean
|
|
public
|
|
public
|
|
public
string
|
|
public
string
|
|
public
integer
|
|
public
string
|
|
public
string
|
|
public
string
|
|
public
boolean
|
|
protected
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
string
|
$mediaName
|
|
public
string
|
$mediaType
|
|
public
integer
|
$mediaSize
|
|
public
string
|
$mediaTmpName
|
|
public
string
|
$mediaError
|
|
public
string
|
$mediaRealType
|
#
''
|
public
string
|
$uploadDir
|
#
''
|
public
array
|
$allowedMimeTypes
|
#
array()
|
public
array
|
$deniedMimeTypes
|
#
array(
'application/x-httpd-php'
)
|
public
integer
|
$maxFileSize
|
#
0
|
public
integer
|
$maxWidth
|
|
public
integer
|
$maxHeight
|
|
public
string
|
$targetFileName
|
|
public
|
$prefix
|
|
public
array
|
$errors
|
#
array()
|
public
string
|
$savedDestination
|
|
public
string
|
$savedFileName
|
|
public
boolean
|
$checkImageType
|
#
true
|
public
array
|
$extensionsToBeSanitized
|
#
array(
'php', 'phtml', 'phtm', 'php3', 'php4', 'cgi', 'pl', 'asp', 'php5'
)
|
public
array
|
$imageExtensions
extensions needed image check (anti-IE Content-Type XSS) |
#
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 => 'swf', 14 => 'iff', 15 => 'wbmp', 16 => 'xbm'
)
|